zhangfeng
2023-07-17 1e4e6a526682ddcd62378b1f2975e7d4b4b2de4f
src/main/java/com/gk/hotwork/Mapper/mybatis/UserInfoMapper.xml
@@ -69,6 +69,10 @@
      <result column="company_id" property="id"  />
      <result column="company" property="company"  />
    </association>
    <association property="specialityInfo" javaType="com.gk.hotwork.Domain.SpecialityInfo">
      <result column="speciality_id" property="id"  />
      <result column="speciality_name" property="name"  />
    </association>
  </resultMap>
  <sql id="Base_Column_List" >
    <!--          -->
@@ -144,6 +148,199 @@
    </where>
  </select>
  <select id="selectCompanyUserDataList" resultMap="UserVo">
    SELECT
    user.id,
    user.username,
    user.email,
    c.company,
    c.id company_id,
    user.department,
    user.job,
    user.createdby,
    user.createddate,
    user.lastmodifiedby,
    user.lastmodifieddate,
    user.status,
    user.expiredate,
    user.isdel,
    user.type,
    user.realname,
    user.idcard,
    user.iscompany,
    user.isdepartment,
    user.isupload,
    user.empno,
    user.deviceno,
    user.cardid,
    user.crossx,
    user.crossy,
    user.updateat,
    user.issecurityofficer,
    user.province,
    user.city,
    user.county,
    user.executive_level
    FROM
    `user` as user
    left join company as c on c.id = user.companyid
    left join userroles as r on r.userid = `user`.id
    <where>
        `user`.status = 1
        and  user.type != 1
      <if test="record.username != null and record.username !=''">
        and user.username like concat ('%',#{record.username,jdbcType=VARCHAR},'%')
      </if>
      <if test="record.realname != null and record.realname !=''">
        and user.realname like concat ('%',#{record.realname,jdbcType=VARCHAR},'%')
      </if>
      <if test="record.company != null and record.company !=''">
        and c.company like concat ('%',#{record.company,jdbcType=VARCHAR},'%')
      </if>
      <if test="record.job != null and record.job !=''">
        and user.job like concat ('%',#{record.job,jdbcType=VARCHAR},'%')
      </if>
      <if test="record.roleId != null">
        and r.roleid = #{record.roleId}
      </if>
    </where>
  </select>
  <select id="selectSuperviseUserDataList" resultMap="UserVo">
    SELECT
    user.id,
    user.username,
    user.email,
    user.company,
    c.id company_id,
    user.department,
    user.job,
    user.createdby,
    user.createddate,
    user.lastmodifiedby,
    user.lastmodifieddate,
    user.status,
    user.expiredate,
    user.isdel,
    user.type,
    user.realname,
    user.idcard,
    user.iscompany,
    user.isdepartment,
    user.isupload,
    user.empno,
    user.deviceno,
    user.cardid,
    user.crossx,
    user.crossy,
    user.updateat,
    user.issecurityofficer,
    user.province,
    user.city,
    user.county,
    user.executive_level
    FROM
    `user` as user
    left join company as c on c.id = user.companyid
    left join userroles as r on r.userid = `user`.id
    <where>
      `user`.status = 1
      and  user.type != 1
      <if test="record.username != null and record.username !=''">
        and user.username like concat ('%',#{record.username,jdbcType=VARCHAR},'%')
      </if>
      <if test="record.realname != null and record.realname !=''">
        and user.realname like concat ('%',#{record.realname,jdbcType=VARCHAR},'%')
      </if>
      <if test="record.company != null and record.company !=''">
        and user.company like concat ('%',#{record.company,jdbcType=VARCHAR},'%')
      </if>
      <if test="record.job != null and record.job !=''">
        and user.job like concat ('%',#{record.job,jdbcType=VARCHAR},'%')
      </if>
      <if test="record.roleId != null">
        and r.roleid = #{record.roleId}
      </if>
      <if test="record.province != null and record.province !=''">
        and user.province = #{record.province}
      </if>
      <if test="record.city != null and record.city !=''">
        and user.city = #{record.city}
      </if>
      <if test="record.county != null and record.county !=''">
        and user.county = #{record.county}
      </if>
    </where>
  </select>
  <select id="selectExpertUserDataList" resultMap="UserVo">
    SELECT
    user.id,
    user.username,
    user.email,
    user.company,
    c.id company_id,
    user.department,
    user.job,
    user.createdby,
    user.createddate,
    user.lastmodifiedby,
    user.lastmodifieddate,
    user.status,
    user.expiredate,
    user.isdel,
    user.type,
    user.realname,
    user.idcard,
    user.iscompany,
    user.isdepartment,
    user.isupload,
    user.empno,
    user.deviceno,
    user.cardid,
    user.crossx,
    user.crossy,
    user.updateat,
    user.issecurityofficer,
    user.province,
    user.city,
    user.county,
    user.executive_level,
    user.professional_level,
    user.speciality_id,
    s.name as speciality_name
    FROM
    `user` as user
    left join company as c on c.id = user.companyid
    left join userroles as r on r.userid = `user`.id
    left join speciality as s on s.id = `user`.speciality_id
    <where>
      `user`.status = 1
      and  user.type != 1
      <if test="record.username != null and record.username !=''">
        and user.username like concat ('%',#{record.username,jdbcType=VARCHAR},'%')
      </if>
      <if test="record.realname != null and record.realname !=''">
        and user.realname like concat ('%',#{record.realname,jdbcType=VARCHAR},'%')
      </if>
      <if test="record.company != null and record.company !=''">
        and user.company like concat ('%',#{record.company,jdbcType=VARCHAR},'%')
      </if>
      <if test="record.job != null and record.job !=''">
        and user.job like concat ('%',#{record.job,jdbcType=VARCHAR},'%')
      </if>
      <if test="record.roleId != null">
        and r.roleid = #{record.roleId}
      </if>
      <if test="record.province != null and record.province !=''">
        and user.province = #{record.province}
      </if>
      <if test="record.city != null and record.city !=''">
        and user.city = #{record.city}
      </if>
      <if test="record.county != null and record.county !=''">
        and user.county = #{record.county}
      </if>
    </where>
  </select>
  <select id="selectUserInfo" resultType="com.gk.hotwork.Domain.UserInfo">
    select user.*,d.department departmentname
    from user as user
@@ -348,4 +545,18 @@
    select * from user where id = #{userId}
  </select>
  <select id="selectExpertList" resultType="com.gk.hotwork.Domain.UserInfo">
    select u.id,u.realname
    from user u
    left join userroles r on r.userid = u.id
    where
        u.status = 1
      and u.type != 1
    and r.roleid = 36
    <if test="realname != null and realname != ''">
      u.realname  like concat("%",#{realname},"%")
    </if>
  </select>
</mapper>