Commit 9d293256 by 墨竹

fix:员工查询判断空

parent b431904b
...@@ -120,12 +120,14 @@ public class AuditApiServiceImpl implements AuditApiService { ...@@ -120,12 +120,14 @@ public class AuditApiServiceImpl implements AuditApiService {
} }
if (CollectionUtil.isNotEmpty(page.getResult())) { if (CollectionUtil.isNotEmpty(page.getResult())) {
List<String> commitStaffIds = page.getResult().stream().map(s -> s.getCommitStaffId()).collect(Collectors.toList()); List<String> commitStaffIds = page.getResult().stream().map(s -> s.getCommitStaffId()).collect(Collectors.toList());
List<TabHaobanStaff> staffList = staffMapper.listByIds(commitStaffIds); if (CollectionUtil.isNotEmpty(commitStaffIds)) {
Map<String, TabHaobanStaff> map = com.gic.commons.util.CollectionUtil.toMap(staffList, "staffId"); List<TabHaobanStaff> staffList = staffMapper.listByIds(commitStaffIds);
for (TabHaobanAudit tab : page.getResult()) { Map<String, TabHaobanStaff> map = com.gic.commons.util.CollectionUtil.toMap(staffList, "staffId");
String commitStaffId = tab.getCommitStaffId(); for (TabHaobanAudit tab : page.getResult()) {
tab.setCommitStaffName(map.get(commitStaffId) == null ? "" : map.get(commitStaffId).getStaffName()); String commitStaffId = tab.getCommitStaffId();
tab.setCommitStaffImg(map.get(commitStaffId) == null ? "" : map.get(commitStaffId).getHeadImg()); tab.setCommitStaffName(map.get(commitStaffId) == null ? "" : map.get(commitStaffId).getStaffName());
tab.setCommitStaffImg(map.get(commitStaffId) == null ? "" : map.get(commitStaffId).getHeadImg());
}
} }
} }
return PageUtil.changePageHelperToCurrentPage(page, AuditDTO.class); return PageUtil.changePageHelperToCurrentPage(page, AuditDTO.class);
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.DepartmentMapper" > <mapper namespace="com.gic.haoban.manage.service.dao.mapper.DepartmentMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanDepartment" > <resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanDepartment">
<id column="department_id" property="departmentId" jdbcType="VARCHAR" /> <id column="department_id" property="departmentId" jdbcType="VARCHAR"/>
<result column="department_name" property="departmentName" jdbcType="VARCHAR" /> <result column="department_name" property="departmentName" jdbcType="VARCHAR"/>
<result column="parent_department_id" property="parentDepartmentId" jdbcType="VARCHAR" /> <result column="parent_department_id" property="parentDepartmentId" jdbcType="VARCHAR"/>
<result column="related_id" property="relatedId" jdbcType="VARCHAR" /> <result column="related_id" property="relatedId" jdbcType="VARCHAR"/>
<result column="related_code" property="relatedCode" jdbcType="VARCHAR" /> <result column="related_code" property="relatedCode" jdbcType="VARCHAR"/>
<result column="chain_id" property="chainId" jdbcType="VARCHAR" /> <result column="chain_id" property="chainId" jdbcType="VARCHAR"/>
<result column="chain_name" property="chainName" jdbcType="VARCHAR" /> <result column="chain_name" property="chainName" jdbcType="VARCHAR"/>
<result column="is_store" property="isStore" jdbcType="INTEGER" /> <result column="is_store" property="isStore" jdbcType="INTEGER"/>
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" /> <result column="status_flag" property="statusFlag" jdbcType="INTEGER"/>
<result column="recycle_flag" property="recycleFlag" jdbcType="INTEGER" /> <result column="recycle_flag" property="recycleFlag" jdbcType="INTEGER"/>
<result column="gic_del_flag" property="gicDelFlag" jdbcType="INTEGER" /> <result column="gic_del_flag" property="gicDelFlag" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="wx_department_id" property="wxDepartmentId" jdbcType="VARCHAR" /> <result column="wx_department_id" property="wxDepartmentId" jdbcType="VARCHAR"/>
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" /> <result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR"/>
<result column="enterprise_id" property="enterpriseId" jdbcType="VARCHAR" /> <result column="enterprise_id" property="enterpriseId" jdbcType="VARCHAR"/>
<result column="sort" property="sort" jdbcType="BIGINT" /> <result column="sort" property="sort" jdbcType="BIGINT"/>
<result column="level" property="level" jdbcType="INTEGER" /> <result column="level" property="level" jdbcType="INTEGER"/>
<result column="temp_flag" property="tempFlag" jdbcType="INTEGER"/> <result column="temp_flag" property="tempFlag" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List">
department_id, department_name, parent_department_id, related_id, related_code,chain_id, is_store, department_id, department_name, parent_department_id, related_id, related_code,chain_id, is_store,
status_flag, recycle_flag, create_time, status_flag, recycle_flag, create_time,
update_time,wx_department_id,sort,level,wx_enterprise_id,chain_name,enterprise_id,gic_del_flag,temp_flag update_time,wx_department_id,sort,level,wx_enterprise_id,chain_name,enterprise_id,gic_del_flag,temp_flag
</sql> </sql>
<sql id="Base_Column_List_short" > <sql id="Base_Column_List_short">
department_id, department_name, parent_department_id,wx_department_id,sort,level department_id, department_name, parent_department_id,wx_department_id,sort,level
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from tab_haoban_department from tab_haoban_department
where department_id = #{departmentId,jdbcType=VARCHAR} where department_id = #{departmentId,jdbcType=VARCHAR}
and status_flag = 1 and status_flag = 1
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" > <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tab_haoban_department delete
where department_id = #{departmentId,jdbcType=VARCHAR} from tab_haoban_department
</delete> where department_id = #{departmentId,jdbcType=VARCHAR}
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDepartment" > </delete>
insert into tab_haoban_department (department_id, department_name, parent_department_id, <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDepartment">
related_id,related_code, chain_id, is_store, insert into tab_haoban_department (department_id, department_name, parent_department_id,
status_flag, recycle_flag, create_time, related_id, related_code, chain_id, is_store,
update_time,wx_department_id,sort,level,wx_enterprise_id,chain_name,enterprise_id,temp_flag) status_flag, recycle_flag, create_time,
values (#{departmentId,jdbcType=VARCHAR}, #{departmentName,jdbcType=VARCHAR}, #{parentDepartmentId,jdbcType=VARCHAR}, update_time, wx_department_id, sort, level, wx_enterprise_id, chain_name,
#{relatedId,jdbcType=VARCHAR},#{relatedCode,jdbcType=VARCHAR}, #{chainId,jdbcType=VARCHAR}, #{isStore,jdbcType=INTEGER}, enterprise_id, temp_flag)
#{statusFlag,jdbcType=INTEGER}, #{recycleFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, values (#{departmentId,jdbcType=VARCHAR}, #{departmentName,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP},#{wxDepartmentId},#{sort},#{level},#{wxEnterpriseId},#{chainName},#{enterpriseId},#{tempFlag}) #{parentDepartmentId,jdbcType=VARCHAR},
</insert> #{relatedId,jdbcType=VARCHAR}, #{relatedCode,jdbcType=VARCHAR}, #{chainId,jdbcType=VARCHAR},
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDepartment" > #{isStore,jdbcType=INTEGER},
insert into tab_haoban_department #{statusFlag,jdbcType=INTEGER}, #{recycleFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
<trim prefix="(" suffix=")" suffixOverrides="," > #{updateTime,jdbcType=TIMESTAMP}, #{wxDepartmentId}, #{sort}, #{level}, #{wxEnterpriseId}, #{chainName},
<if test="departmentId != null" > #{enterpriseId}, #{tempFlag})
department_id, </insert>
</if> <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDepartment">
<if test="departmentName != null" > insert into tab_haoban_department
department_name, <trim prefix="(" suffix=")" suffixOverrides=",">
</if> <if test="departmentId != null">
<if test="parentDepartmentId != null" > department_id,
parent_department_id, </if>
</if> <if test="departmentName != null">
<if test="relatedId != null" > department_name,
related_id, </if>
</if> <if test="parentDepartmentId != null">
<if test="relatedCode != null" > parent_department_id,
related_code, </if>
</if> <if test="relatedId != null">
<if test="chainId != null" > related_id,
chain_id, </if>
</if> <if test="relatedCode != null">
<if test="chainName != null" > related_code,
chain_name, </if>
</if> <if test="chainId != null">
<if test="isStore != null" > chain_id,
is_store, </if>
</if> <if test="chainName != null">
<if test="statusFlag != null" > chain_name,
status_flag, </if>
</if> <if test="isStore != null">
<if test="recycleFlag != null" > is_store,
recycle_flag, </if>
</if> <if test="statusFlag != null">
<if test="createTime != null" > status_flag,
create_time, </if>
</if> <if test="recycleFlag != null">
<if test="updateTime != null" > recycle_flag,
update_time, </if>
</if> <if test="createTime != null">
<if test="wxDepartmentId != null" > create_time,
wx_department_id, </if>
</if> <if test="updateTime != null">
<if test="wxEnterpriseId != null" > update_time,
wx_enterprise_id, </if>
</if> <if test="wxDepartmentId != null">
<if test="enterpriseId != null" > wx_department_id,
enterprise_id, </if>
</if> <if test="wxEnterpriseId != null">
<if test="sort != null" > wx_enterprise_id,
sort, </if>
</if> <if test="enterpriseId != null">
<if test="level != null" > enterprise_id,
level, </if>
</if> <if test="sort != null">
</trim> sort,
<trim prefix="values (" suffix=")" suffixOverrides="," > </if>
<if test="departmentId != null" > <if test="level != null">
#{departmentId,jdbcType=VARCHAR}, level,
</if> </if>
<if test="departmentName != null" > </trim>
#{departmentName,jdbcType=VARCHAR}, <trim prefix="values (" suffix=")" suffixOverrides=",">
</if> <if test="departmentId != null">
<if test="parentDepartmentId != null" > #{departmentId,jdbcType=VARCHAR},
#{parentDepartmentId,jdbcType=VARCHAR}, </if>
</if> <if test="departmentName != null">
<if test="relatedId != null" > #{departmentName,jdbcType=VARCHAR},
#{relatedId,jdbcType=VARCHAR}, </if>
</if> <if test="parentDepartmentId != null">
<if test="relatedCode != null" > #{parentDepartmentId,jdbcType=VARCHAR},
#{relatedCode,jdbcType=VARCHAR}, </if>
</if> <if test="relatedId != null">
<if test="chainId != null" > #{relatedId,jdbcType=VARCHAR},
#{chainId,jdbcType=VARCHAR}, </if>
</if> <if test="relatedCode != null">
<if test="chainName != null" > #{relatedCode,jdbcType=VARCHAR},
#{chainName,jdbcType=VARCHAR}, </if>
</if> <if test="chainId != null">
<if test="isStore != null" > #{chainId,jdbcType=VARCHAR},
#{isStore,jdbcType=INTEGER}, </if>
</if> <if test="chainName != null">
<if test="statusFlag != null" > #{chainName,jdbcType=VARCHAR},
#{statusFlag,jdbcType=INTEGER}, </if>
</if> <if test="isStore != null">
<if test="recycleFlag != null" > #{isStore,jdbcType=INTEGER},
#{recycleFlag,jdbcType=INTEGER}, </if>
</if> <if test="statusFlag != null">
<if test="createTime != null" > #{statusFlag,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, </if>
</if> <if test="recycleFlag != null">
<if test="updateTime != null" > #{recycleFlag,jdbcType=INTEGER},
#{updateTime,jdbcType=TIMESTAMP}, </if>
</if> <if test="createTime != null">
<if test="wxDepartmentId != null" > #{createTime,jdbcType=TIMESTAMP},
#{wxDepartmentId}, </if>
</if> <if test="updateTime != null">
<if test="wxEnterpriseId != null" > #{updateTime,jdbcType=TIMESTAMP},
#{wxEnterpriseId}, </if>
</if> <if test="wxDepartmentId != null">
<if test="enterpriseId != null" > #{wxDepartmentId},
#{enterpriseId}, </if>
</if> <if test="wxEnterpriseId != null">
<if test="sort != null" > #{wxEnterpriseId},
#{sort}, </if>
</if> <if test="enterpriseId != null">
<if test="level != null" > #{enterpriseId},
#{level}, </if>
</if> <if test="sort != null">
</trim> #{sort},
</insert> </if>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDepartment" > <if test="level != null">
update tab_haoban_department #{level},
<set > </if>
<if test="departmentName != null" > </trim>
department_name = #{departmentName,jdbcType=VARCHAR}, </insert>
</if> <update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDepartment">
<if test="parentDepartmentId != null" > update tab_haoban_department
parent_department_id = #{parentDepartmentId,jdbcType=VARCHAR}, <set>
</if> <if test="departmentName != null">
<if test="relatedId != null" > department_name = #{departmentName,jdbcType=VARCHAR},
related_id = #{relatedId,jdbcType=VARCHAR}, </if>
</if> <if test="parentDepartmentId != null">
<if test="relatedCode != null" > parent_department_id = #{parentDepartmentId,jdbcType=VARCHAR},
related_code = #{relatedCode,jdbcType=VARCHAR}, </if>
</if> <if test="relatedId != null">
<if test="chainId != null" > related_id = #{relatedId,jdbcType=VARCHAR},
chain_id = #{chainId,jdbcType=VARCHAR}, </if>
</if> <if test="relatedCode != null">
<if test="chainName != null" > related_code = #{relatedCode,jdbcType=VARCHAR},
chain_name = #{chainName,jdbcType=VARCHAR}, </if>
</if> <if test="chainId != null">
<if test="isStore != null" > chain_id = #{chainId,jdbcType=VARCHAR},
is_store = #{isStore,jdbcType=INTEGER}, </if>
</if> <if test="chainName != null">
<if test="statusFlag != null" > chain_name = #{chainName,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER}, </if>
</if> <if test="isStore != null">
<if test="recycleFlag != null" > is_store = #{isStore,jdbcType=INTEGER},
recycle_flag = #{recycleFlag,jdbcType=INTEGER}, </if>
</if> <if test="statusFlag != null">
<if test="createTime != null" > status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}, </if>
</if> <if test="recycleFlag != null">
<if test="updateTime != null" > recycle_flag = #{recycleFlag,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=TIMESTAMP}, </if>
</if> <if test="createTime != null">
<if test="wxDepartmentId != null" > create_time = #{createTime,jdbcType=TIMESTAMP},
wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR}, </if>
</if> <if test="updateTime != null">
<if test="wxEnterpriseId != null" > update_time = #{updateTime,jdbcType=TIMESTAMP},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}, </if>
</if> <if test="wxDepartmentId != null">
<if test="enterpriseId != null" > wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=VARCHAR}, </if>
</if> <if test="wxEnterpriseId != null">
<if test="sort != null" > wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
sort = #{sort}, </if>
</if> <if test="enterpriseId != null">
<if test="level != null" > enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
level = #{level,jdbcType=INTEGER}, </if>
</if> <if test="sort != null">
<if test="gicDelFlag != null" > sort = #{sort},
gic_del_flag = #{gicDelFlag,jdbcType=INTEGER}, </if>
</if> <if test="level != null">
</set> level = #{level,jdbcType=INTEGER},
where department_id = #{departmentId,jdbcType=VARCHAR} </if>
</update> <if test="gicDelFlag != null">
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDepartment" > gic_del_flag = #{gicDelFlag,jdbcType=INTEGER},
update tab_haoban_department </if>
set department_name = #{departmentName,jdbcType=VARCHAR}, </set>
parent_department_id = #{parentDepartmentId,jdbcType=VARCHAR}, where department_id = #{departmentId,jdbcType=VARCHAR}
related_id = #{relatedId,jdbcType=VARCHAR}, </update>
related_code = #{relatedCode,jdbcType=VARCHAR}, <update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDepartment">
chain_id = #{chainId,jdbcType=VARCHAR}, update tab_haoban_department
chain_name = #{chainName,jdbcType=VARCHAR}, set department_name = #{departmentName,jdbcType=VARCHAR},
wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR}, parent_department_id = #{parentDepartmentId,jdbcType=VARCHAR},
is_store = #{isStore,jdbcType=INTEGER}, related_id = #{relatedId,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER}, related_code = #{relatedCode,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER}, chain_id = #{chainId,jdbcType=VARCHAR},
level = #{level,jdbcType=INTEGER}, chain_name = #{chainName,jdbcType=VARCHAR},
recycle_flag = #{recycleFlag,jdbcType=INTEGER}, wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}, is_store = #{isStore,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=TIMESTAMP}, status_flag = #{statusFlag,jdbcType=INTEGER},
gic_del_flag = #{gicDelFlag}, sort = #{sort,jdbcType=INTEGER},
wx_enterprise_id = #{wxEnterpriseId}, level = #{level,jdbcType=INTEGER},
enterprise_id = #{enterpriseId} recycle_flag = #{recycleFlag,jdbcType=INTEGER},
where department_id = #{departmentId,jdbcType=VARCHAR} create_time = #{createTime,jdbcType=TIMESTAMP},
</update> update_time = #{updateTime,jdbcType=TIMESTAMP},
gic_del_flag = #{gicDelFlag},
<select id="listByParentId" resultMap="BaseResultMap" parameterType="java.lang.String" > wx_enterprise_id = #{wxEnterpriseId},
select enterprise_id = #{enterpriseId}
<include refid="Base_Column_List" /> where department_id = #{departmentId,jdbcType=VARCHAR}
from tab_haoban_department </update>
where parent_department_id = #{parentId,jdbcType=VARCHAR}
and status_flag = 1
and recycle_flag != 1
order by sort desc
</select>
<select id="listDepartmentLikeName" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where department_name like CONCAT('%',#{departmentName,jdbcType=VARCHAR},'%')
and status_flag = 1
</select>
<select id="selectMaxSort" resultType="java.lang.Long" parameterType="java.lang.String" >
select
ifnull(max(sort),0)
from tab_haoban_department
where parent_department_id = #{parentDepartmentId,jdbcType=VARCHAR}
and status_flag = 1
</select>
<select id="selectByRelatedId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where related_id = #{relatedId,jdbcType=VARCHAR}
and status_flag = 1
</select>
<select id="getByWxId" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="listByParentId" resultMap="BaseResultMap" parameterType="java.lang.String">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from tab_haoban_department from tab_haoban_department
where wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR} where parent_department_id = #{parentId,jdbcType=VARCHAR}
and wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1
and status_flag = 1 and recycle_flag != 1
</select> order by sort desc
</select>
<select id="pageDepartmentByParams" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where status_flag = 1
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="keyword != null and keyword != ''">
and (department_name like CONCAT('%',#{keyword},'%') or wx_department_id like CONCAT('%',#{keyword},'%') or related_code like CONCAT('%',#{keyword},'%'))
</if>
<if test="recycleFlag != null">
and recycle_flag = #{recycleFlag}
</if>
<if test="storeFlag != null">
and is_store = #{storeFlag}
</if>
order by sort desc
</select>
<select id="listByDepartmentIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where status_flag = 1
<if test="storeFlag != null">
and is_store = #{storeFlag}
</if>
<if test="departmentIds != null and departmentIds.size() > 0">
and department_id IN
<foreach collection="departmentIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
order by sort desc
</select>
<select id="listByRelatedIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where status_flag = 1
and is_store = 1
<if test="relatedIds != null and relatedIds.size() > 0">
and related_id IN
<foreach collection="relatedIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
order by sort desc
</select>
<select id="listStoreByWxEnterpriseId" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where status_flag = 1
and is_store = 1
and wx_enterprise_id = #{wxEnterpriseId}
order by create_time
</select>
<select id="getRootByEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where level = 1
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
</select>
<select id="pageFullStoreByWxEnterpriseId" resultMap="BaseResultMap" >
SELECT
t.*
FROM
(
select
@rownum := @rownum + 1 AS rownum,
<include refid="Base_Column_List" />
from tab_haoban_department,
(SELECT(@rowNum := 0)) b
where status_flag = 1
and is_store = 1
and wx_enterprise_id = #{wxEnterpriseId}
<if test="search != null and search != ''">
and wx_department_id like CONCAT('%',#{search},'%')
</if>
<if test="storeIds != null and storeIds.size != 0">
and related_id IN
<foreach collection="storeIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
order by create_time
) t WHERE t.rownum > #{minCount}
</select>
<select id="pageFullStoreByWxEnterpriseId2" resultMap="BaseResultMap" >
SELECT
t.*
FROM
(
select
@rownum := @rownum + 1 AS rownum,
<include refid="Base_Column_List" />
from tab_haoban_department,
(SELECT(@rowNum := 0)) b
where status_flag = 1
and is_store = 1
and wx_enterprise_id = #{wxEnterpriseId}
and ( wx_department_id like CONCAT('%',#{search},'%')
or related_id IN
<foreach collection="storeIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
)
order by create_time
) t WHERE t.rownum > #{minCount}
</select>
<select id="getByRelatedId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where related_id = #{relatedId}
and status_flag = 1
</select>
<select id="getByRelatedIdNotInRecycle" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where related_id = #{relatedId}
and status_flag = 1
and recycle_flag != 1
</select>
<select id="pageByParentId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where status_flag = 1
and recycle_flag != 1
<if test="parentId != null and parentId != ''">
and parent_department_id = #{parentId}
</if>
<if test="keyword != null and keyword != ''">
and (department_name like CONCAT('%',#{keyword},'%') or wx_department_id like CONCAT('%',#{keyword},'%'))
</if>
order by sort desc
</select>
<select id="listByChainId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where wx_enterprise_id = #{wxEnterpriseId}
and chain_id like CONCAT(#{chainId},'%')
and status_flag = 1
</select>
<select id="departmentRecycleCount" resultType="java.lang.Integer" parameterType="java.lang.String" >
select
count(1)
from tab_haoban_department
where wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
and recycle_flag = 1
</select>
<select id="countSyncDepartmentByEnterpriseId" resultType="java.lang.Integer" parameterType="java.lang.String" >
select
count(1)
from tab_haoban_department
where enterprise_id = #{enterpriseId}
and status_flag = 1
and gic_del_flag is null
</select>
<select id="countByDepartment" resultType="java.lang.Integer" parameterType="java.lang.String" >
select
count(1)
from tab_haoban_department
where parent_department_id = #{departmentId}
and status_flag = 1
and recycle_flag != 1
</select>
<select id="listByIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where status_flag = 1
<if test="departmentIds != null and departmentIds.size() > 0">
and department_id IN
<foreach collection="departmentIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
order by sort desc
</select>
<select id="listDepartmentLikeName" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_department
where department_name like CONCAT('%',#{departmentName,jdbcType=VARCHAR},'%')
and status_flag = 1
</select>
<select id="getTempFlagDepartment" resultMap="BaseResultMap" parameterType="java.lang.String"> <select id="selectMaxSort" resultType="java.lang.Long" parameterType="java.lang.String">
select select ifnull(max(sort), 0)
<include refid="Base_Column_List"/> from tab_haoban_department
from tab_haoban_department where parent_department_id = #{parentDepartmentId,jdbcType=VARCHAR}
where wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1
and status_flag = 1 </select>
and temp_flag = 1
</select>
<select id="totalStoreCountByEnterpriseId" resultType="java.lang.Integer" parameterType="java.lang.String" >
select
count(1)
from tab_haoban_department
where wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
and recycle_flag != 1
and is_store = 1
</select>
<update id="cleanDepartment" > <select id="selectByRelatedId" resultMap="BaseResultMap" parameterType="java.lang.String">
update tab_haoban_department select
set <include refid="Base_Column_List"/>
status_flag = 0, from tab_haoban_department
update_time=now() where related_id = #{relatedId,jdbcType=VARCHAR}
where wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1 and and status_flag = 1
wx_department_id not in </select>
<foreach collection="dIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<select id="listDepartmentByWxDepartIds" resultMap="BaseResultMap" > <select id="getByWxId" resultMap="BaseResultMap" parameterType="java.lang.String">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from tab_haoban_department from tab_haoban_department
where wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1 and where wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR}
wx_department_id in and wx_enterprise_id = #{wxEnterpriseId}
<foreach collection="dIds" item="item" open="(" separator="," close=")"> and status_flag = 1
#{item} </select>
</foreach>
</select>
<select id="listAllDepartment" resultMap="BaseResultMap" > <select id="pageDepartmentByParams" resultMap="BaseResultMap" parameterType="java.lang.String">
select select
<include refid="Base_Column_List_short" /> <include refid="Base_Column_List"/>
from tab_haoban_department from tab_haoban_department
where wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1 where status_flag = 1
order by sort desc <if test="wxEnterpriseId != null and wxEnterpriseId != ''">
</select> and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="keyword != null and keyword != ''">
and (department_name like CONCAT('%',#{keyword},'%') or wx_department_id like CONCAT('%',#{keyword},'%') or
related_code like CONCAT('%',#{keyword},'%'))
</if>
<if test="recycleFlag != null">
and recycle_flag = #{recycleFlag}
</if>
<if test="storeFlag != null">
and is_store = #{storeFlag}
</if>
order by sort desc
</select>
<select id="searchDepartment" resultMap="BaseResultMap" > <select id="listByDepartmentIds" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List_short" /> <include refid="Base_Column_List"/>
from tab_haoban_department from tab_haoban_department
where wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1 where status_flag = 1
and department_name likelike CONCAT('%',#{search},'%') <if test="storeFlag != null">
and is_store = #{storeFlag}
</if>
<if test="departmentIds != null and departmentIds.size() > 0">
and department_id IN
<foreach collection="departmentIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
order by sort desc
</select>
<select id="listByRelatedIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_department
where status_flag = 1
and is_store = 1
<if test="relatedIds != null and relatedIds.size() > 0">
and related_id IN
<foreach collection="relatedIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
order by sort desc
</select>
</select> <select id="listStoreByWxEnterpriseId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_department
where status_flag = 1
and is_store = 1
and wx_enterprise_id = #{wxEnterpriseId}
order by create_time
</select>
<select id="getRootByEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_department
where level = 1
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
</select>
<select id="pageFullStoreByWxEnterpriseId" resultMap="BaseResultMap">
SELECT
t.*
FROM
(
select
@rownum := @rownum + 1 AS rownum,
<include refid="Base_Column_List"/>
from tab_haoban_department,
(SELECT(@rowNum := 0)) b
where status_flag = 1
and is_store = 1
and wx_enterprise_id = #{wxEnterpriseId}
<if test="search != null and search != ''">
and wx_department_id like CONCAT('%',#{search},'%')
</if>
<if test="storeIds != null and storeIds.size != 0">
and related_id IN
<foreach collection="storeIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
order by create_time
) t WHERE t.rownum > #{minCount}
</select>
<select id="pageFullStoreByWxEnterpriseId2" resultMap="BaseResultMap">
SELECT
t.*
FROM
(
select
@rownum := @rownum + 1 AS rownum,
<include refid="Base_Column_List"/>
from tab_haoban_department,
(SELECT(@rowNum := 0)) b
where status_flag = 1
and is_store = 1
and wx_enterprise_id = #{wxEnterpriseId}
and ( wx_department_id like CONCAT('%',#{search},'%')
or related_id IN
<foreach collection="storeIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
)
order by create_time
) t WHERE t.rownum > #{minCount}
</select>
<select id="getByRelatedId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_department
where related_id = #{relatedId}
and status_flag = 1
</select>
<select id="getByRelatedIdNotInRecycle" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_department
where related_id = #{relatedId}
and status_flag = 1
and recycle_flag != 1
</select>
<select id="pageByParentId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_department
where status_flag = 1
and recycle_flag != 1
<if test="parentId != null and parentId != ''">
and parent_department_id = #{parentId}
</if>
<if test="keyword != null and keyword != ''">
and (department_name like CONCAT('%',#{keyword},'%') or wx_department_id like CONCAT('%',#{keyword},'%'))
</if>
order by sort desc
</select>
<select id="listByChainId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_department
where wx_enterprise_id = #{wxEnterpriseId}
and chain_id like CONCAT(#{chainId},'%')
and status_flag = 1
</select>
<select id="departmentRecycleCount" resultType="java.lang.Integer" parameterType="java.lang.String">
select count(1)
from tab_haoban_department
where wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
and recycle_flag = 1
</select>
<select id="countSyncDepartmentByEnterpriseId" resultType="java.lang.Integer" parameterType="java.lang.String">
select count(1)
from tab_haoban_department
where enterprise_id = #{enterpriseId}
and status_flag = 1
and gic_del_flag is null
</select>
<select id="countByDepartment" resultType="java.lang.Integer" parameterType="java.lang.String">
select count(1)
from tab_haoban_department
where parent_department_id = #{departmentId}
and status_flag = 1
and recycle_flag != 1
</select>
<select id="listByIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_department
where status_flag = 1
and department_id IN
<foreach collection="departmentIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
order by sort desc
</select>
<select id="getTempFlagDepartment" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_department
where wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
and temp_flag = 1
</select>
<select id="totalStoreCountByEnterpriseId" resultType="java.lang.Integer" parameterType="java.lang.String">
select count(1)
from tab_haoban_department
where wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
and recycle_flag != 1
and is_store = 1
</select>
<update id="cleanDepartment">
update tab_haoban_department
set
status_flag = 0,
update_time=now()
where wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1 and
wx_department_id not in
<foreach collection="dIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<select id="listDepartmentByWxDepartIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_department
where wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1 and
wx_department_id in
<foreach collection="dIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="listAllDepartment" resultMap="BaseResultMap">
select
<include refid="Base_Column_List_short"/>
from tab_haoban_department
where wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1
order by sort desc
</select>
<select id="searchDepartment" resultMap="BaseResultMap">
select
<include refid="Base_Column_List_short"/>
from tab_haoban_department
where wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1
and department_name likelike CONCAT('%',#{search},'%')
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -45,7 +45,8 @@ ...@@ -45,7 +45,8 @@
<update id="delOtherStaffByWxUserId"> <update id="delOtherStaffByWxUserId">
update tab_haoban_staff update tab_haoban_staff
set status_flag = 0,update_time = now() set status_flag = 0,
update_time = now()
where wx_enterprise_id = #{wxEnterpriseId} where wx_enterprise_id = #{wxEnterpriseId}
and wx_user_id = #{wxUserId} and wx_user_id = #{wxUserId}
and status_flag = 1 and status_flag = 1
...@@ -295,12 +296,10 @@ ...@@ -295,12 +296,10 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tab_haoban_staff from tab_haoban_staff
where status_flag = 1 where status_flag = 1
<if test="staffIds != null and staffIds.size() > 0"> and staff_id IN
and staff_id IN <foreach collection="staffIds" item="id" index="index" open="(" close=")" separator=",">
<foreach collection="staffIds" item="id" index="index" open="(" close=")" separator=","> #{id,jdbcType=VARCHAR}
#{id,jdbcType=VARCHAR} </foreach>
</foreach>
</if>
</select> </select>
<select id="listByWxUserId" resultMap="BaseResultMap"> <select id="listByWxUserId" resultMap="BaseResultMap">
select select
...@@ -344,12 +343,10 @@ ...@@ -344,12 +343,10 @@
from tab_haoban_staff from tab_haoban_staff
where status_flag = 1 where status_flag = 1
and wx_enterprise_id = #{wxEnterpriseId} and wx_enterprise_id = #{wxEnterpriseId}
<if test="userIds != null and userIds.size() > 0"> and wx_user_id IN
and wx_user_id IN <foreach collection="userIds" item="id" index="index" open="(" close=")" separator=",">
<foreach collection="userIds" item="id" index="index" open="(" close=")" separator=","> #{id,jdbcType=VARCHAR}
#{id,jdbcType=VARCHAR} </foreach>
</foreach>
</if>
</select> </select>
<update id="cleanStaff" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff"> <update id="cleanStaff" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff">
...@@ -473,7 +470,8 @@ ...@@ -473,7 +470,8 @@
<update id="delStaffByWxUserId"> <update id="delStaffByWxUserId">
update tab_haoban_staff update tab_haoban_staff
set status_flag = 0,update_time = now() set status_flag = 0,
update_time = now()
where wx_enterprise_id = #{wxEnterpriseId} where wx_enterprise_id = #{wxEnterpriseId}
and wx_user_id = #{wxUserId} and wx_user_id = #{wxUserId}
and status_flag = 1 and status_flag = 1
...@@ -482,7 +480,8 @@ ...@@ -482,7 +480,8 @@
<update id="delStaffByPhoneNumber"> <update id="delStaffByPhoneNumber">
update tab_haoban_staff update tab_haoban_staff
set status_flag = 0,update_time = now() set status_flag = 0,
update_time = now()
where wx_enterprise_id = #{wxEnterpriseId} where wx_enterprise_id = #{wxEnterpriseId}
and phone_number = #{phoneNumber} and phone_number = #{phoneNumber}
and status_flag = 1 and status_flag = 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment