UserAttendanceRelMapper.xml 4.86 KB
Newer Older
yuquan.zhu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
<?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" >
<mapper namespace="cn.timer.api.dao.kqgl.UserAttendanceRelMapper" >
  <resultMap id="BaseResultMap" type="cn.timer.api.bean.kqgl.UserAttendanceRel" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="kqzid" property="kqzid" jdbcType="INTEGER" />
    <result column="userid" property="userid" jdbcType="INTEGER" />
    <result column="qyid" property="qyid" jdbcType="INTEGER" />
    
    <result column="empnum" property="empnum" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, kqzid, userid, qyid
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from kqgl_asso_yhkqz
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from kqgl_asso_yhkqz
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="cn.timer.api.bean.kqgl.UserAttendanceRel" >
    insert into kqgl_asso_yhkqz (id, kqzid, userid, 
      qyid)
    values (#{id,jdbcType=INTEGER}, #{kqzid,jdbcType=INTEGER}, #{userid,jdbcType=INTEGER}, 
      #{qyid,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="cn.timer.api.bean.kqgl.UserAttendanceRel" >
    insert into kqgl_asso_yhkqz
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="kqzid != null" >
        kqzid,
      </if>
      <if test="userid != null" >
        userid,
      </if>
      <if test="qyid != null" >
        qyid,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="kqzid != null" >
        #{kqzid,jdbcType=INTEGER},
      </if>
      <if test="userid != null" >
        #{userid,jdbcType=INTEGER},
      </if>
      <if test="qyid != null" >
        #{qyid,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="cn.timer.api.bean.kqgl.UserAttendanceRel" >
    update kqgl_asso_yhkqz
    <set >
      <if test="kqzid != null" >
        kqzid = #{kqzid,jdbcType=INTEGER},
      </if>
      <if test="userid != null" >
        userid = #{userid,jdbcType=INTEGER},
      </if>
      <if test="qyid != null" >
        qyid = #{qyid,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.timer.api.bean.kqgl.UserAttendanceRel" >
    update kqgl_asso_yhkqz
    set kqzid = #{kqzid,jdbcType=INTEGER},
      userid = #{userid,jdbcType=INTEGER},
      qyid = #{qyid,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
  
  
  <insert id="insertKqglAssoKqzdkfsList" parameterType="java.util.List" >
	    insert into kqgl_asso_yhkqz (kqzid, userid, qyid)
	    <foreach collection="list" item="item" index="index" open="values " close="" separator=",">
	   	(
	      <if test="item.kqzid != null" >
	        #{item.kqzid,jdbcType=INTEGER},
	      </if>
	      <if test="item.userid != null" >
	        #{item.userid,jdbcType=INTEGER},
	      </if>
	      <if test="item.qyid != null" >
	        #{item.qyid,jdbcType=INTEGER}
	      </if>
	      )
	    </foreach>
   </insert>
   
   <delete id="deleteByPrimaryBykqzid" parameterType="java.lang.Integer" >
    delete from kqgl_asso_yhkqz
    where kqzid = #{kqzid,jdbcType=INTEGER}
  </delete>
  
  <select id="selectAttendanceOfficerByKqzid" resultMap="BaseResultMap">
		select yhkqz.*,
			us.emp_num as empnum 
			from kqgl_asso_yhkqz yhkqz
		LEFT JOIN yggl_main_emp as us on us.emp_num = yhkqz.userid and us.org_code = #{orgcode}
		where yhkqz.kqzid = #{kqzid,jdbcType=INTEGER}
  </select>
  
  
  <delete id="deleteByPrimaryByUserid" parameterType="java.lang.Integer" >
    delete from kqgl_asso_yhkqz
    where userid = #{userid,jdbcType=INTEGER}
  </delete>
  
  <select id="selectAttNotMember" resultMap="BaseResultMap">
  		select id,kqzid,qyid,userid
			from (select kqz.`name`,
					dkfs.dkfsid,
					dkfs.type,
					yhkqz.id,
					yhkqz.kqzid,
					yhkqz.qyid,
					yhkqz.userid
				from kqgl_asso_yhkqz yhkqz
			LEFT JOIN kqgl_main_kqz as kqz on kqz.id = yhkqz.kqzid
			LEFT JOIN kqgl_asso_kqzdkfs as dkfs on dkfs.kqz_id = yhkqz.kqzid 
			where 1=1
			and dkfs.type = 1) as aa
		where aa.userid not in (select yhsb.user_id from kqgl_asso_yhsb yhsb where yhsb.kqjid = #{dkfsid})
		and aa.dkfsid = #{dkfsid}
		and aa.qyid = #{qyid}
  </select>
  
  <select id="selectByPrimaryByqyid" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from kqgl_asso_yhkqz
    where qyid = #{qyid,jdbcType=INTEGER}
  </select>
  
</mapper>