dongdingding 1 month ago
commit 9203bdc762

@ -0,0 +1,42 @@
package com.ruoyi.tc.controller;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.tc.service.UnitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
*
* @author du
* @since 2024/12/9 10:42
*/
@Api(tags = "组织架构")
@RestController
@RequestMapping("/tc/schema")
public class DeptSchemaController {
@Resource
private UnitService unitService;
/**
*
*/
@ApiOperation(value = "根据资产类型返回组织架构")
@GetMapping
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "0:web资产1:小程序资产2公众号资产3电子邮件资产4移动应用程序资产", required = true),
})
public AjaxResult schema(@RequestParam("type") String type) {
return AjaxResult.success(unitService.getSchema(type));
}
}

@ -222,7 +222,6 @@ public class UnitController {
@ApiOperation(value = "修改单位密码")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@GetMapping("/edit/{id}")
@PreAuthorize("@ss.hasAnyRoles('admin')")
@Transactional(rollbackFor = Exception.class)
public AjaxResult editPassword(@PathVariable Long id) {
String password = PasswordGenerator.password();

@ -1,6 +1,7 @@
package com.ruoyi.tc.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;
@ -138,4 +139,7 @@ public class AssetApp extends BaseClass implements Serializable {
@ApiModelProperty("删除标志0代表存在 2代表删除")
private String delFlag;
@ApiModelProperty("组织机构名称(部门名称)")
@TableField(exist = false)
private String deptName;
}

@ -42,6 +42,11 @@ public class AssetCurrent extends BaseClass implements Serializable {
@Excel(name = "*系统名称",sort = 2,width = 40,required = true)
private String xtmc;
@ApiModelProperty("组织机构名称(部门名称)")
@TableField(exist = false)
private String deptName;
/**
*
*/

@ -1,6 +1,7 @@
package com.ruoyi.tc.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;
@ -21,6 +22,9 @@ import java.io.Serializable;
@TableName(value = "asset_email")
public class AssetEmail extends BaseClass implements Serializable {
@ApiModelProperty("组织机构名称(部门名称)")
@TableField(exist = false)
private String deptName;
@ApiModelProperty("id")
@TableId(value = "id",type = IdType.AUTO)

@ -33,6 +33,10 @@ public class AssetMiniPrograms extends BaseClass implements Serializable {
@ApiModelProperty("id")
@TableId(value = "id",type = IdType.AUTO)
private Long id;
@ApiModelProperty("组织机构名称(部门名称)")
@TableField(exist = false)
private String deptName;
/**
*
*/

@ -1,6 +1,7 @@
package com.ruoyi.tc.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.annotation.Excel;
@ -27,6 +28,10 @@ public class AssetOfficialAccount extends BaseClass implements Serializable {
@TableId(value = "id",type = IdType.AUTO)
private Long id;
@ApiModelProperty("组织机构名称(部门名称)")
@TableField(exist = false)
private String deptName;
/**
*
*/

@ -2,6 +2,7 @@ package com.ruoyi.tc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.tc.entity.AssetTask;
import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.request.GeneralQueryRequest;
@ -84,4 +85,33 @@ public interface UnitMapper extends BaseMapper<Unit> {
* 5
*/
Integer selectTaskId(@Param("dwmc") String dwmc,@Param("type") String type);
/**
* app
*/
List<SysDept> getAppSchema();
/**
* email
*/
List<SysDept> getEmailSchema();
/**
*
*/
List<SysDept> getMiniSchema();
/**
*
*/
List<SysDept> getGzpSchema();
/**
* web
*/
List<SysDept> getWebSchema();
}

@ -3,6 +3,7 @@ package com.ruoyi.tc.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.tc.entity.AssetTask;
import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.request.GeneralQueryRequest;
@ -88,4 +89,10 @@ public interface UnitService extends IService<Unit> {
* @return
*/
Integer findBydwmc(String part);
/**
*
*/
List<TreeSelect> getSchema(String type);
}

@ -2,13 +2,15 @@ package com.ruoyi.tc.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.PasswordGenerator;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.tc.entity.AssetTask;
import com.ruoyi.tc.entity.Unit;
import com.ruoyi.tc.entity.request.GeneralQueryRequest;
import com.ruoyi.tc.entity.request.UnitRequest;
@ -17,6 +19,7 @@ import com.ruoyi.tc.service.UnitService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
@ -28,9 +31,13 @@ import java.util.List;
@Service
public class UnitServiceImpl extends ServiceImpl<UnitMapper, Unit> implements UnitService {
@Resource
private ISysUserService userService;
@Resource
private ISysDeptService iSysDeptService;
/**
*
*
@ -144,4 +151,32 @@ public class UnitServiceImpl extends ServiceImpl<UnitMapper, Unit> implements Un
return baseMapper.findBydwmc(part);
}
/**
*
*/
@Override
public List<TreeSelect> getSchema(String type) {
List<SysDept> appSchema = new ArrayList<>();
switch (type) {
case "0":
appSchema = baseMapper.getWebSchema();
break;
case "1":
appSchema = baseMapper.getMiniSchema();
break;
case "2":
appSchema = baseMapper.getGzpSchema();
break;
case "3":
appSchema = baseMapper.getEmailSchema();
break;
case "4":
appSchema = baseMapper.getAppSchema();
break;
default:
break;
}
return iSysDeptService.buildDeptTreeSelect(appSchema);
}
}

@ -15,26 +15,32 @@
</delete>
<select id="page" resultType="com.ruoyi.tc.entity.AssetApp">
select * from asset_app
select a.*,c.dept_name as deptName from asset_app a
left join unit_info b on a.ssdw = b.nick_name
left join sys_dept c on b.dept_id = c.dept_id
<where>
del_flag = '0'
a.del_flag = '0' and b.del_flag = '0'
<if test="req.yymc!=null and req.yymc!='' ">
and app_name like concat('%',#{req.yymc},'%')
and a.app_name like concat('%',#{req.yymc},'%')
</if>
<if test="req.dwmc!=null and req.dwmc!='' ">
and ssdw like concat('%',#{req.dwmc},'%')
and a.ssdw like concat('%',#{req.dwmc},'%')
</if>
<if test="req.startTime != null ">
and create_time &gt;= #{req.startTime}
and a.create_time &gt;= #{req.startTime}
</if>
<if test="req.endTime != null">
and create_time &lt;= #{req.endTime}
and a.create_time &lt;= #{req.endTime}
</if>
<if test="req.xtzt != null">
and icp_state = #{req.xtzt}
and a.icp_state = #{req.xtzt}
</if>
<if test="req.deptId != null">
AND (b.dept_id = #{req.deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
find_in_set(#{req.deptId}, ancestors) ))
</if>
</where>
order by create_time desc
order by a.create_time desc
</select>
<select id="findBydwmc" resultType="java.lang.Integer" parameterType="java.lang.String">
select count(*)

@ -13,29 +13,35 @@
<select id="page" resultType="com.ruoyi.tc.entity.AssetCurrent">
select * from asset_current
select a.* from asset_current a
left join unit_info b on a.dwmc = b.nick_name
left join sys_dept c on b.dept_id = c.dept_id
<where>
del_flag = '0'
a. del_flag = '0' and b.del_flag = '0'
<if test="req.xtmc!=null and req.xtmc!='' ">
and xtmc like concat('%',#{req.xtmc},'%')
and a.xtmc like concat('%',#{req.xtmc},'%')
</if>
<if test="req.dwmc!=null and req.dwmc!='' ">
and dwmc like concat('%',#{req.dwmc},'%')
and a.dwmc like concat('%',#{req.dwmc},'%')
</if>
<if test="req.xtlx!=null">
and xtlx = #{req.xtlx}
and a.xtlx = #{req.xtlx}
</if>
<if test="req.xtzt!=null">
and xtzt = #{req.xtzt}
and a.xtzt = #{req.xtzt}
</if>
<if test="req.startTime != null ">
and create_time &gt;= #{req.startTime}
and a.create_time &gt;= #{req.startTime}
</if>
<if test="req.endTime != null">
and create_time &lt;= #{req.endTime}
and a.create_time &lt;= #{req.endTime}
</if>
<if test="req.deptId != null">
AND (b.dept_id = #{req.deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
find_in_set(#{req.deptId}, ancestors) ))
</if>
</where>
order by create_time desc
order by a.create_time desc
</select>
<select id="page1" resultType="com.ruoyi.tc.entity.AssetExport">

@ -15,26 +15,32 @@
</delete>
<select id="page" resultType="com.ruoyi.tc.entity.AssetEmail">
select * from asset_email
select a.* from asset_email a
left join unit_info b on a.ssdw = b.nick_name
left join sys_dept c on b.dept_id = c.dept_id
<where>
del_flag = '0'
a.del_flag = '0' and b.del_flag = '0'
<if test="req.dzyxhz!=null and req.dzyxhz!='' ">
and dzyxhz like concat('%',#{req.dzyxhz},'%')
and a.dzyxhz like concat('%',#{req.dzyxhz},'%')
</if>
<if test="req.dwmc!=null and req.dwmc!='' ">
and ssdw like concat('%',#{req.dwmc},'%')
and a.ssdw like concat('%',#{req.dwmc},'%')
</if>
<if test="req.startTime != null ">
and create_time &gt;= #{req.startTime}
and a.create_time &gt;= #{req.startTime}
</if>
<if test="req.endTime != null">
and create_time &lt;= #{req.endTime}
and a.create_time &lt;= #{req.endTime}
</if>
<if test="req.xtzt != null">
and yjxtzc = #{req.xtzt}
and a.yjxtzc = #{req.xtzt}
</if>
<if test="req.deptId != null">
AND (b.dept_id = #{req.deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
find_in_set(#{req.deptId}, ancestors) ))
</if>
</where>
order by create_time desc
order by a.create_time desc
</select>
<select id="findBydwmc" resultType="java.lang.Integer" parameterType="java.lang.String">
select count(*)

@ -15,26 +15,32 @@
</delete>
<select id="page" resultType="com.ruoyi.tc.entity.AssetMiniPrograms">
select * from asset_mini_programs
select a.* from asset_mini_programs a
left join unit_info b on a.ssdw = b.nick_name
left join sys_dept c on b.dept_id = c.dept_id
<where>
del_flag = '0'
a.del_flag = '0' and b.del_flag = '0'
<if test="req.xcxmc!=null and req.xcxmc!='' ">
and xcxmc like concat('%',#{req.xcxmc},'%')
and a.xcxmc like concat('%',#{req.xcxmc},'%')
</if>
<if test="req.dwmc!=null and req.dwmc!='' ">
and ssdw like concat('%',#{req.dwmc},'%')
and a.ssdw like concat('%',#{req.dwmc},'%')
</if>
<if test="req.startTime != null ">
and create_time &gt;= #{req.startTime}
and a.create_time &gt;= #{req.startTime}
</if>
<if test="req.endTime != null">
and create_time &lt;= #{req.endTime}
and a.create_time &lt;= #{req.endTime}
</if>
<if test="req.xtzt != null">
and state = #{req.xtzt}
and a.state = #{req.xtzt}
</if>
<if test="req.deptId != null">
AND (b.dept_id = #{req.deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
find_in_set(#{req.deptId}, ancestors) ))
</if>
</where>
order by create_time desc
order by a.create_time desc
</select>
<select id="findBydwmc" resultType="java.lang.Integer" parameterType="java.lang.String">

@ -19,26 +19,32 @@
where ssdw = #{part} and isbf=0 and del_flag=0
</select>
<select id="page" resultType="com.ruoyi.tc.entity.AssetOfficialAccount">
select * from asset_official_account
select a.* from asset_official_account a
left join unit_info b on a.ssdw = b.nick_name
left join sys_dept c on b.dept_id = c.dept_id
<where>
del_flag = '0'
a.del_flag = '0' and b.del_flag = '0'
<if test="req.gzhmc!=null and req.gzhmc!='' ">
and gzhmc like concat('%',#{req.gzhmc},'%')
and a.gzhmc like concat('%',#{req.gzhmc},'%')
</if>
<if test="req.dwmc!=null and req.dwmc!='' ">
and ssdw like concat('%',#{req.dwmc},'%')
and a.ssdw like concat('%',#{req.dwmc},'%')
</if>
<if test="req.startTime != null ">
and create_time &gt;= #{req.startTime}
and a.create_time &gt;= #{req.startTime}
</if>
<if test="req.endTime != null">
and create_time &lt;= #{req.endTime}
and a.create_time &lt;= #{req.endTime}
</if>
<if test="req.xtzt != null">
and gzhzt = #{req.xtzt}
and a.gzhzt = #{req.xtzt}
</if>
<if test="req.deptId != null">
AND (b.dept_id = #{req.deptId} OR b.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
find_in_set(#{req.deptId}, ancestors) ))
</if>
</where>
order by create_time desc
order by a.create_time desc
</select>
</mapper>

@ -212,6 +212,176 @@
<select id="selectTaskId" resultType="java.lang.Integer">
select id from asset_task where dwmc like concat('%',#{dwmc},'%') and type like concat('%',#{type},'%')
</select>
<select id="getAppSchema" resultType="com.ruoyi.common.core.domain.entity.SysDept">
WITH RECURSIVE category_tree AS (-- 初始查询找出根节点或特定parentid的记录
SELECT
d.*
FROM
asset_app a
LEFT JOIN unit_info b ON a.ssdw = b.nick_name
LEFT JOIN sys_dept d ON b.dept_id = d.dept_id
WHERE
d.dept_id IS NOT NULL
AND d.parent_id != 0
GROUP BY
d.dept_id,
d.parent_id,
d.ancestors,
d.dept_name,
d.order_num,
d.leader,
d.phone,
d.email,
d.STATUS,
d.del_flag,
d.create_by,
d.create_time UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据
SELECT
d.*
FROM
sys_dept d
JOIN category_tree ct ON d.dept_id = ct.parent_id
) SELECT
*
FROM
category_tree;
</select>
<select id="getEmailSchema" resultType="com.ruoyi.common.core.domain.entity.SysDept">
WITH RECURSIVE category_tree AS (-- 初始查询找出根节点或特定parentid的记录
SELECT
d.*
FROM
asset_email a
LEFT JOIN unit_info b ON a.ssdw = b.nick_name
LEFT JOIN sys_dept d ON b.dept_id = d.dept_id
WHERE
d.dept_id IS NOT NULL
AND d.parent_id != 0
GROUP BY
d.dept_id,
d.parent_id,
d.ancestors,
d.dept_name,
d.order_num,
d.leader,
d.phone,
d.email,
d.STATUS,
d.del_flag,
d.create_by,
d.create_time UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据
SELECT
d.*
FROM
sys_dept d
JOIN category_tree ct ON d.dept_id = ct.parent_id
) SELECT
*
FROM
category_tree;
</select>
<select id="getMiniSchema" resultType="com.ruoyi.common.core.domain.entity.SysDept">
WITH RECURSIVE category_tree AS (-- 初始查询找出根节点或特定parentid的记录
SELECT
d.*
FROM
asset_mini_programs a
LEFT JOIN unit_info b ON a.ssdw = b.nick_name
LEFT JOIN sys_dept d ON b.dept_id = d.dept_id
WHERE
d.dept_id IS NOT NULL
AND d.parent_id != 0
GROUP BY
d.dept_id,
d.parent_id,
d.ancestors,
d.dept_name,
d.order_num,
d.leader,
d.phone,
d.email,
d.STATUS,
d.del_flag,
d.create_by,
d.create_time UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据
SELECT
d.*
FROM
sys_dept d
JOIN category_tree ct ON d.dept_id = ct.parent_id
) SELECT
*
FROM
category_tree;
</select>
<select id="getGzpSchema" resultType="com.ruoyi.common.core.domain.entity.SysDept">
WITH RECURSIVE category_tree AS (-- 初始查询找出根节点或特定parentid的记录
SELECT
d.*
FROM
asset_official_account a
LEFT JOIN unit_info b ON a.ssdw = b.nick_name
LEFT JOIN sys_dept d ON b.dept_id = d.dept_id
WHERE
d.dept_id IS NOT NULL
AND d.parent_id != 0
GROUP BY
d.dept_id,
d.parent_id,
d.ancestors,
d.dept_name,
d.order_num,
d.leader,
d.phone,
d.email,
d.STATUS,
d.del_flag,
d.create_by,
d.create_time UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据
SELECT
d.*
FROM
sys_dept d
JOIN category_tree ct ON d.dept_id = ct.parent_id
) SELECT
*
FROM
category_tree;
</select>
<select id="getWebSchema" resultType="com.ruoyi.common.core.domain.entity.SysDept">
WITH RECURSIVE category_tree AS (-- 初始查询找出根节点或特定parentid的记录
SELECT
d.*
FROM
asset_current a
LEFT JOIN unit_info b ON a.dwmc = b.nick_name
LEFT JOIN sys_dept d ON b.dept_id = d.dept_id
WHERE
d.dept_id IS NOT NULL
AND d.parent_id != 0
GROUP BY
d.dept_id,
d.parent_id,
d.ancestors,
d.dept_name,
d.order_num,
d.leader,
d.phone,
d.email,
d.STATUS,
d.del_flag,
d.create_by,
d.create_time UNION ALL-- 递归查询根据parentid为上级id继续查询下一级数据
SELECT
d.*
FROM
sys_dept d
JOIN category_tree ct ON d.dept_id = ct.parent_id
) SELECT
*
FROM
category_tree;
</select>
<update id="deleteUnits">
update unit_info

Loading…
Cancel
Save