郑永安
2023-07-24 0645153dfa233b51a749db73f9bd5a8c5127c595
src/main/java/com/gk/hotwork/Mapper/mybatis/UserInfoMapper.xml
@@ -39,6 +39,7 @@
    <result column="password" property="password" jdbcType="VARCHAR" />
    <result column="email" property="email" jdbcType="VARCHAR" />
    <result column="company" property="company" jdbcType="VARCHAR" />
    <result column="companyid" property="companyid" jdbcType="BIGINT" />
    <result column="department" property="department" jdbcType="VARCHAR" />
    <result column="job" property="job" jdbcType="VARCHAR" />
    <result column="createdby" property="createdby" jdbcType="VARCHAR" />
@@ -65,9 +66,20 @@
    <result column="crossy" property="crossY" jdbcType="DECIMAL" />
    <result column="issecurityofficer" property="issecurityofficer" jdbcType="TINYINT" />
    <result column="updateat" property="updateat" jdbcType="TIMESTAMP" />
    <result column="executive_level" property="executiveLevel" jdbcType="INTEGER" />
    <result column="province" property="province" jdbcType="VARCHAR" />
    <result column="city" property="city" jdbcType="VARCHAR" />
    <result column="county" property="county" jdbcType="VARCHAR" />
    <result column="professional_level" property="professionalLevel" jdbcType="INTEGER" />
    <result column="speciality_id" property="specialityId" jdbcType="BIGINT" />
    <result column="speciality_name" property="specialityName" jdbcType="VARCHAR" />
    <association property="companyInfo" javaType="com.gk.hotwork.Domain.CompanyInfo">
      <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 +156,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 = 3
      <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 = 2
      <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 = 4
      <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
@@ -163,10 +368,12 @@
    select
    `user`.*,
    c.ismain AS isMainCompany,
    d.department departmentname
    d.department departmentname,
    s.name as speciality_name
    from `user` as user
    LEFT JOIN company as c ON c.id = `user`.companyid
    left join department as d on d.id = user.department and d.isdel = 0
    left join speciality as s on s.id = `user`.speciality_id
    where
     `user`.username = #{username,jdbcType=VARCHAR}
    and `user`.status = 1
@@ -348,4 +555,32 @@
    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 = 4
    <if test="realname != null and realname != ''">
      u.realname  like concat("%",#{realname},"%")
    </if>
  </select>
  <select id="selectUserVoById" resultType="com.gk.hotwork.Domain.Vo.UserVo">
    select
      `user`.*,
      c.ismain AS isMainCompany,
      d.department departmentname,
      s.name as speciality_name
    from `user` as user
    LEFT JOIN company as c ON c.id = `user`.companyid
      left join department as d on d.id = user.department and d.isdel = 0
      left join speciality as s on s.id = `user`.speciality_id
    where
      `user`.id = #{userId}
      and `user`.status = 1
  </select>
</mapper>