| | |
| | | |
| | | @GetMapping("tree") |
| | | @ApiOperation("列表") |
| | | @RequiresPermissions("sys:company:list") |
| | | //@RequiresPermissions("sys:company:list") |
| | | public Result<List<SysDept>> list() { |
| | | |
| | | List<SysDept> list = sysDeptService.getCompanyTree(); |
| | |
| | | |
| | | @GetMapping("{id}") |
| | | @ApiOperation("信息") |
| | | @RequiresPermissions("sys:company:info") |
| | | //@RequiresPermissions("sys:company:info") |
| | | public Result<SysDept> get(@PathVariable("id") Long id) { |
| | | SysDept data = sysDeptService.get(id); |
| | | |
| | |
| | | @PostMapping |
| | | @ApiOperation("新增") |
| | | @LogOperation("组织管理模块--->新增") |
| | | @RequiresPermissions("sys:company") |
| | | //@RequiresPermissions("sys:company") |
| | | public Result insert(@RequestBody SysDept entity) { |
| | | |
| | | // 默认基础信息 |
| | |
| | | @PutMapping |
| | | @ApiOperation("修改") |
| | | @LogOperation("组织管理模块--->修改") |
| | | @RequiresPermissions("sys:company:update") |
| | | //@RequiresPermissions("sys:company:update") |
| | | public Result update(@RequestBody SysDept entity) { |
| | | // 效验数据 |
| | | ValidatorUtils.validateEntity(entity, UpdateGroup.class, DefaultGroup.class); |
| | |
| | | @DeleteMapping |
| | | @ApiOperation("删除") |
| | | @LogOperation("组织管理模块--->删除") |
| | | @RequiresPermissions("sys:company:delete") |
| | | //@RequiresPermissions("sys:company:delete") |
| | | public Result delete(@RequestBody Long[] ids) { |
| | | // 效验数据 |
| | | AssertUtils.isArrayEmpty(ids, "ids"); |
| | |
| | | if (dept.isCompany()) { |
| | | dept.setCompanyId(dept.getId()); |
| | | } |
| | | |
| | | dept.setTenantId(1L); |
| | | super.insert(dept); |
| | | |
| | | // 更新数据范围表 |
| | |
| | | <mapper namespace="com.zt.modules.sys.dao.SysDeptDao"> |
| | | |
| | | <select id="getAll" resultType="com.zt.core.sys.model.SysDept"> |
| | | select a.dept_id as id |
| | | ,a.dept_name as name |
| | | ,a.parent_id as pid |
| | | ,a.dept_code as code |
| | | ,a.ancestors as pids |
| | | ,a.dept_type as nature |
| | | ,a.order_num as sort |
| | | ,(select t2.dept_name from SYS_DEPT t2 where t2.dept_id=a.parent_id) parentName |
| | | ,(select t2.dept_name from SYS_DEPT t2 where t2.dept_id = a.parent_id) companyName |
| | | select a.id as id |
| | | ,a.name as name |
| | | ,a.pid as pid |
| | | ,a.code as code |
| | | ,a.pids as pids |
| | | ,a.IS_COMPANY |
| | | ,a.nature as nature |
| | | ,a.sort as sort |
| | | ,(select t2.name from SYS_DEPT t2 where t2.id=a.pid) parentName |
| | | ,(select t2.name from SYS_DEPT t2 where t2.id = a.pid) companyName |
| | | from SYS_DEPT a |
| | | where a.del_flag = 0 |
| | | order by a.dept_type, a.order_num asc |
| | | where a.is_delete = 0 |
| | | order by a.nature, a.sort asc |
| | | </select> |
| | | |
| | | <select id="getList" resultType="com.zt.core.sys.model.SysDept"> |
| | | select a.dept_id as id |
| | | ,a.dept_name as name |
| | | ,a.dept_code as code |
| | | ,a.parent_id as pid |
| | | ,a.ancestors as pids |
| | | ,a.dept_type as nature |
| | | ,a.order_num as sort |
| | | ,(select t2.dept_name from SYS_DEPT t2 where t2.dept_id=a.parent_id) parentName |
| | | select a.id as id |
| | | ,a.name as name |
| | | ,a.code as code |
| | | ,a.pid as pid |
| | | ,a.pids as pids |
| | | ,a.nature as nature |
| | | ,a.sort as sort |
| | | ,(select t2.name from SYS_DEPT t2 where t2.id=a.pid) parentName |
| | | from SYS_DEPT a |
| | | where a.del_flag=0 |
| | | <!-- <if test="isCompany != null"> |
| | | where a.is_delete=0 |
| | | <if test="isCompany != null"> |
| | | and a.is_company = #{isCompany} |
| | | </if> |
| | | <if test="companyId != null"> |
| | |
| | | </if> |
| | | <if test="tenantId != null"> |
| | | and a.tenant_id = #{tenantId} |
| | | </if>--> |
| | | </if> |
| | | <if test="deptIds != null"> |
| | | and a.id in |
| | | <foreach item="id" collection="deptIds" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | order by a.order_num asc |
| | | order by a.sort asc |
| | | </select> |
| | | |
| | | <select id="getById" resultType="com.zt.core.sys.model.SysDept"> |
| | | select a.dept_id as id |
| | | ,a.dept_name as name |
| | | ,a.dept_code as code |
| | | ,a.parent_id as pid |
| | | ,a.ancestors as pids |
| | | ,a.dept_type as nature |
| | | ,a.order_num as sort |
| | | ,(select t2.dept_name from SYS_DEPT t2 where t2.dept_id=a.parent_id) parentName |
| | | select a.id |
| | | ,a.name |
| | | ,a.code |
| | | ,a.pid |
| | | ,a.pids |
| | | ,a.nature |
| | | ,a.sort |
| | | ,(select t2.name from SYS_DEPT t2 where t2.id=a.pid) parentName |
| | | from SYS_DEPT a |
| | | where a.del_flag=0 |
| | | and a.dept_id = #{value} |
| | | where a.is_delete=0 |
| | | and a.id = #{value} |
| | | </select> |
| | | |
| | | <select id="getListByParent" resultType="com.zt.core.sys.model.SysDept"> |
| | | select a.dept_id as id |
| | | ,a.dept_name as name |
| | | ,a.dept_code as code |
| | | ,a.parent_id as pid |
| | | ,a.ancestors as pids |
| | | ,a.dept_type as nature |
| | | ,a.order_num as sort |
| | | ,(select t2.dept_name from SYS_DEPT t2 where t2.dept_id=a.parent_id) parentName |
| | | select a.id |
| | | ,a.name |
| | | ,a.code |
| | | ,a.pid |
| | | ,a.pids |
| | | ,a.nature |
| | | ,a.sort |
| | | ,(select t2.name from SYS_DEPT t2 where t2.id=a.pid) parentName |
| | | from SYS_DEPT a |
| | | where a.del_flag=0 |
| | | where a.is_delete=0 |
| | | <if test="pCode != null"> |
| | | and parent_id in (select dept_id from SYS_DEPT where dept_CODE= #{pCode}) |
| | | and pid in (select id from SYS_DEPT where code= #{pCode}) |
| | | </if> |
| | | <if test="code != null"> |
| | | and dept_CODE= #{code} |
| | | and code= #{code} |
| | | </if> |
| | | <if test="pId != null"> |
| | | and parent_id = #{pId} |
| | | and pid = #{pId} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | <select id="getList" resultType="com.zt.core.sys.model.SysUser"> |
| | | select a.* |
| | | ,(select t2.dept_name from SYS_DEPT t2 where t2.dept_id = a.dept_id) deptName |
| | | ,(select t2.name from SYS_DEPT t2 where t2.id = a.dept_id) deptName |
| | | from SYS_USER a |
| | | where a.is_delete = 0 |
| | | <if test="username != null and username.trim() != ''"> |
| | |
| | | , a.username |
| | | , a.real_name |
| | | , a.MOBILE |
| | | , (select t2.dept_name from SYS_DEPT t2 where t2.dept_id = a.dept_id) deptName |
| | | , (select t2.name from SYS_DEPT t2 where t2.id = a.dept_id) deptName |
| | | from SYS_USER a |
| | | where a.del_flag = 0 |
| | | and a.id = #{value} |
| | |
| | | , a.username |
| | | , a.real_name |
| | | , a.MOBILE |
| | | , (select t2.dept_name from SYS_DEPT t2 where t2.dept_id = a.dept_id) deptName |
| | | , (select t2.name from SYS_DEPT t2 where t2.id = a.dept_id) deptName |
| | | , a.password |
| | | from SYS_USER a |
| | | where a.is_delete = 0 |
| | |
| | | and dept_id = #{unitid} |
| | | </if> |
| | | <if test="code != null and code != ''"> |
| | | or dept_id in (select dept_id from SYS_DEPT where dept_code=#{code})) |
| | | or dept_id in (select id from SYS_DEPT where code=#{code})) |
| | | </if> |
| | | <if test="password != null and password != ''"> |
| | | and password = #{password} |
| | |
| | | , a.username |
| | | , a.real_name |
| | | , a.MOBILE |
| | | , (select t2.dept_name from SYS_DEPT t2 where t2.dept_id = a.dept_id) deptName |
| | | , (select t2.name from SYS_DEPT t2 where t2.id = a.dept_id) deptName |
| | | from SYS_USER a |
| | | where a.is_delete = 0 |
| | | # and a.code = #{code} |
| | |
| | | SELECT |
| | | a.real_Name, |
| | | c.name as roleName, |
| | | (select dept_name from SYS_DEPT d where a.DEPT_ID = d.DEPT_ID AND d.del_flag=0 limit 1 ) as deptName |
| | | (select name from SYS_DEPT d where a.DEPT_ID = d.ID AND d.is_delete=0 limit 1 ) as deptName |
| | | FROM |
| | | SYS_USER a, |
| | | SYS_ROLE_USER b, |