提交修改

This commit is contained in:
quyixiao 2020-11-20 17:22:39 +08:00
parent 67049f5df3
commit e66d1cf50a
4 changed files with 27 additions and 6 deletions

View File

@ -13,10 +13,12 @@ import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.enums.ResultRecordStatusEnum;
import com.lz.modules.app.enums.RoleEnums;
import com.lz.modules.app.resp.Step;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.dao.StaffRoleMapper;
import com.lz.modules.flow.entity.RecordAuth;
import com.lz.modules.flow.entity.StaffRole;
import com.lz.modules.flow.model.FlowModel;
@ -39,10 +41,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.swing.*;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Consumer;
import java.util.stream.Collectors;
@ -274,6 +273,18 @@ public class TestController {
return R.ok().put("data",map);
}
@Autowired
private StaffRoleMapper staffRoleMapper;
// http://localhost:8080/lz_management/test/testmaster
@RequestMapping("/test/testmaster")
public R testmaster(Long userId) throws Exception{
List<StaffRole> masterPMs = staffRoleMapper.selectStaffRolesByDepartmentLevelList(Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName()}));
return R.ok();
}
public static void main(String[] args) {
String a = "{\"313\":[17,20,13]}";

View File

@ -68,4 +68,6 @@ public interface StaffRoleMapper extends BaseMapper<StaffRole> {
List<StaffMenu> selectMenusByParentId(@Param("parentId") long parentId);
List<StaffRole> selectStaffRolesByDepartmentLevelList(@Param("departmentLevels") List<String> departmentLevels);
}

View File

@ -425,8 +425,8 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
com.lz.modules.app.utils.BeanUtils.copyProperty(staffRole, roleModel);
staffRole.setStaffName(staffEntity.getName());
StaffRole masterPM = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(roleModel.getStaffId(), Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName()}));
if(masterPM !=null){
List<StaffRole> masterPMs = staffRoleMapper.selectStaffRolesByDepartmentLevelList(Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName()}));
if(CollectionUtils.isNotEmpty(masterPMs)){
return R.error("主管理员只能设置一个,如果想添加,只能更改管理员。");
}
staffRoleMapper.insertStaffRole(staffRole);

View File

@ -197,5 +197,13 @@
</select>
<select id="selectStaffRolesByDepartmentLevelList" resultType="com.lz.modules.flow.entity.StaffRole">
select * from lz_staff_role where is_delete = 0 and department_level in
<foreach collection="departmentLevels" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</select>
</mapper>