李宇
2021-04-26 df938f06da12eddacfc9d2aee52d153222f5aa2c
src/main/java/com/nanometer/smartlab/dao/SysUserDao.xml
@@ -65,9 +65,6 @@
    <if test="seeFlag != null">
      and su.see_flag = #{seeFlag}
    </if>
    <if test="seeFlag != null">
      and su.see_flag = #{seeFlag}
    </if>
    <if test="editId != null and editId != ''">
      and su.id != #{editId}
    </if>
@@ -87,10 +84,18 @@
    where id = #{id} and valid_flag = 1
  </select>
  <select id="getUser" parameterType="java.lang.String" resultType="java.util.Map">
    select * from sys_user
  <select id="getUser" parameterType="java.lang.String" resultMap="SysUser">
    select
    sys_user.id,
   sys_user.`name`,
    sys_user.phone,
    sys_user.project,
    base_meta.meta_value as department
    from sys_user
    left join  base_meta on sys_user.department = base_meta.id
    where sys_user.id = #{id} and sys_user.valid_flag = 1
    where sys_user.id = #{id}
    and sys_user.valid_flag = 1
    and base_meta.valid_flag = 1
  </select>
  <insert id="insertUserFavor" parameterType="java.util.Map">
@@ -276,6 +281,59 @@
        select * from sys_user
        where arp = #{0} and valid_flag = 1
    </select>
    <select id="getUserCountInProject" parameterType="java.util.Map"  resultType="java.lang.Integer">
        select count(1) from sys_user as su
        left join base_meta bm on su.department = bm.id
        left join base_meta bm1 on bm1.id = su.company
        where su.valid_flag = 1
        <if test="departmentNameLike != null and departmentNameLike != ''">
            and bm.meta_value  like concat("%",#{departmentNameLike},"%")
        </if>
        <if test="arp != null and arp != ''">
            and su.arp like concat("%",#{arp},"%")
        </if>
        <if test="name != null and name != ''">
            and su.name like concat("%",#{name},"%")
        </if>
        <if test="company != null and company != ''">
            and bm1.meta_value like concat("%",#{company},"%")
        </if>
        <if test="project != null and project != ''">
            and
            <foreach item="item" index="index" collection="project.split(',')" open="(" separator="or" close=")">
                 su.project like concat("%",#{item},"%")
            </foreach>
        </if>
    </select>
    <select id="getUserInProject" parameterType="java.util.Map" resultMap="SysUser">
        select su.*, br.name as roleName from sys_user as su
        left join base_role as br on su.role_id = br.id
        left join base_meta bm on su.department = bm.id
        left join base_meta bm1 on bm1.id = su.company
        where su.valid_flag = 1
        <if test="departmentNameLike != null and departmentNameLike != ''">
            and bm.meta_value  like concat("%",#{departmentNameLike},"%")
        </if>
        <if test="arp != null and arp != ''">
            and su.arp like concat("%",#{arp},"%")
        </if>
        <if test="name != null and name != ''">
            and su.name like concat("%",#{name},"%")
        </if>
        <if test="company != null and company != ''">
            and bm1.meta_value like concat("%",#{company},"%")
        </if>
        <if test="project != null and project != ''">
            and
            <foreach item="item" index="index" collection="project.split(',')" open="(" separator="or" close=")">
                su.project like concat("%",#{item},"%")
            </foreach>
        </if>
        order by su.arp ASC
        <if test="first != null and pageSize != null">
            limit #{first}, #{pageSize}
        </if>
    </select>
    <update id="updateUserPointBySelective" parameterType="java.util.Map">
    update sys_user set point=#{point}
    <where>