KqglAssoPbmxMapper.xml 6.46 KB
Newer Older
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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
<?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.kqmk.KqglAssoPbmxMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.kqmk.KqglAssoPbmx" >
                <id column="id" property="id" />
                <result column="userid" property="userid" />
                <result column="data" property="data" />
                <result column="bcid" property="bcid" />
                <result column="kqzid" property="kqzid" />
    </resultMap>
    
    <resultMap id="AssoPbmxMap" type="cn.timer.api.dto.kqmk.KqglAssoPbmxDto" >
		    <id column="id" property="id"  />
		    <result column="userid" property="userid"  />
		    <result column="data" property="data" />
		    <result column="bcid" property="bcid"  />
		    <result column="kqzid" property="kqzid"  />
		    
		    <result column="bcname" property="bcname"  />
		    <result column="sbdk1" property="sbdk1"  />
		    <result column="sbqjks1" property="sbqjks1"  />
		    <result column="sbqjjs1" property="sbqjjs1"  />
		    
		    <result column="xbdk1" property="xbdk1"  />
		    <result column="xbqjks1" property="xbqjks1"  />
		    <result column="xbqjjs1" property="xbqjjs1"  />
		    
		    <result column="sbdk2" property="sbdk2"  />
		    <result column="sbqjks2" property="sbqjks2"  />
		    <result column="sbqjjs2" property="sbqjjs2"  />
		    
		    <result column="xbdk2" property="xbdk2"  />
		    <result column="xbqjks2" property="xbqjks2"  />
		    <result column="xbqjjs2" property="xbqjjs2"  />
		    
		    <result column="sbdk3" property="sbdk3"  />
		    <result column="sbqjks3" property="sbqjks3"  />
		    <result column="sbqjjs3" property="sbqjjs3"  />
		    
		    <result column="xbdk3" property="xbdk3"  />
		    <result column="xbqjks3" property="xbqjks3"  />
		    <result column="xbqjjs3" property="xbqjjs3"  />
		    
		    <result column="isxbdk" property="isxbdk"  />
		    
		    <result column="sxbcs" property="sxbcs"  />
	  </resultMap>

    <sql id="Base_Column_List">
                id,
                userid,
                data,
                bcid,
                kqzid
    </sql>
    
    <sql id="Base_Column_List_Alias">
                id KqglAssoPbmx_id,
                userid KqglAssoPbmx_userid,
                data KqglAssoPbmx_data,
                bcid KqglAssoPbmx_bcid,
                kqzid KqglAssoPbmx_kqzid
    </sql>

	<select id="getScheduleSpecificAttendance" resultMap="AssoPbmxMap">
  		select pbmx.*,
			bcsz.`name` bcname,
			bcsz.sbdk1,
			bcsz.sbqjks1,
			bcsz.sbqjjs1,
			bcsz.xbdk1,
			bcsz.xbqjks1,
			bcsz.xbqjjs1,
			bcsz.sbdk2,
			bcsz.sbqjks2,
			bcsz.sbqjjs2,
			bcsz.xbdk2,
			bcsz.xbqjks2,
			bcsz.xbqjjs2,
			bcsz.sbdk3,
			bcsz.sbqjks3,
			bcsz.sbqjjs3,
			bcsz.xbdk3,
			bcsz.xbqjks3,
			bcsz.xbqjjs3,
			bcsz.sxbcs,
			bcsz.is_xbdk as isxbdk
		 from kqgl_asso_pbmx pbmx
		LEFT JOIN kqgl_asso_bcsz as bcsz on bcsz.id = pbmx.bcid
		where pbmx.kqzid = #{kqzid}
		and pbmx.userid = #{userid}
		and pbmx.`data` = #{date}
  </select>
  
  <insert id="insertKqglAssoPbmxList" parameterType="java.util.List" >
	    insert into kqgl_asso_pbmx (userid, data, bcid, kqzid)
	    <foreach collection="list" item="item" index="index" open="values " close="" separator=",">
	   	(
	      <if test="item.userid != null" >
	        #{item.userid,jdbcType=INTEGER},
	      </if>
	      <if test="item.data != null" >
	        #{item.data,jdbcType=DATE},
	      </if>
	      <if test="item.bcid != null" >
	        #{item.bcid,jdbcType=INTEGER},
	      </if>
	      <if test="item.kqzid != null" >
	        #{item.kqzid,jdbcType=INTEGER}
	      </if>
	      )
	    </foreach>
   </insert>
	
	<select id="selectAttGroupScheduling" resultMap="AssoPbmxMap">
  		select pbmx.*,
			info.`name` as username,
			bcsz.`name` bcname,
			SUBSTR(pbmx.`data`,1,7) as yemo,
      		SUBSTR(pbmx.`data`,9,10) as xsrq
		from kqgl_asso_pbmx pbmx
		LEFT JOIN yggl_main_emp as info on info.emp_num = pbmx.userid
		LEFT JOIN kqgl_asso_bcsz as bcsz on bcsz.id = pbmx.bcid
		where info.org_code = #{qyid,jdbcType=INTEGER}
		<if test="date != null" >
			and SUBSTR(pbmx.`data`,1,7) = #{date,jdbcType=VARCHAR}
		</if>
		and pbmx.kqzid = #{kqzid,jdbcType=INTEGER}
   </select>
	<!-- 

    <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoPbmx">
        INSERT INTO kqgl_asso_pbmx
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != userid'>
                        userid,
                        </if>
                        <if test ='null != data'>
                        data,
                        </if>
                        <if test ='null != bcid'>
                        bcid,
                        </if>
                        <if test ='null != kqzid'>
                        kqzid
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != userid'>
                        #{userid},
                        </if>
                        <if test ='null != data'>
                        #{data},
                        </if>
                        <if test ='null != bcid'>
                        #{bcid},
                        </if>
                        <if test ='null != kqzid'>
                        #{kqzid}
                        </if>
        </trim>
    </insert>

    <delete id="delete" >
        DELETE FROM kqgl_asso_pbmx
        WHERE id = #{id}
    </delete>

    <update id="update" parameterType="cn.timer.api.bean.kqmk.KqglAssoPbmx">
        UPDATE kqgl_asso_pbmx
        <set>
                    <if test ='null != userid'>userid = #{userid},</if>
                    <if test ='null != data'>data = #{data},</if>
                    <if test ='null != bcid'>bcid = #{bcid},</if>
                    <if test ='null != kqzid'>kqzid = #{kqzid}</if>
        </set>
        WHERE id = #{id}
    </update>


    <select id="load" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM kqgl_asso_pbmx
        WHERE id = #{id}
    </select>

    <select id="pageList" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM kqgl_asso_pbmx
        LIMIT #{offset}, #{pageSize}
    </select>

    <select id="pageListCount" resultType="java.lang.Integer">
        SELECT count(1)
        FROM kqgl_asso_pbmx
    </select>

	 -->

</mapper>