PunchCardDetailsMapper.xml 13.1 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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380
<?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.PunchCardDetailsMapper" >
  <resultMap id="BaseResultMap" type="cn.timer.api.bean.kqgl.PunchCardDetails" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="userid" property="userid" jdbcType="INTEGER" />
    <result column="data" property="data" jdbcType="VARCHAR" />
    <result column="sbdk1" property="sbdk1" jdbcType="BIGINT" />
    <result column="sbdk1jg" property="sbdk1jg" jdbcType="INTEGER" />
    <result column="xbdk1" property="xbdk1" jdbcType="BIGINT" />
    <result column="xbdk1jg" property="xbdk1jg" jdbcType="INTEGER" />
    <result column="sbdk2" property="sbdk2" jdbcType="BIGINT" />
    <result column="sbdk2jg" property="sbdk2jg" jdbcType="INTEGER" />
    <result column="xbdk2" property="xbdk2" jdbcType="BIGINT" />
    <result column="xbdk2jg" property="xbdk2jg" jdbcType="INTEGER" />
    <result column="sbdk3" property="sbdk3" jdbcType="BIGINT" />
    <result column="sbdk3jg" property="sbdk3jg" jdbcType="INTEGER" />
    <result column="xbdk3" property="xbdk3" jdbcType="BIGINT" />
    <result column="xbdk3jg" property="xbdk3jg" jdbcType="INTEGER" />
    <result column="ydkcs" property="ydkcs" jdbcType="INTEGER" />
    <result column="gzsc" property="gzsc" jdbcType="DOUBLE" />
    <result column="qyid" property="qyid" jdbcType="INTEGER" />
    <result column="dksj" property="dksj" jdbcType="BIGINT" />
    
    <result column="dept" property="dept" jdbcType="VARCHAR" />
    <result column="post" property="post" jdbcType="VARCHAR" />
    
    <result column="username" property="username" jdbcType="VARCHAR" />
    <result column="attdate" property="attdate" jdbcType="VARCHAR" />
	<result column="bcname" property="bcname" jdbcType="VARCHAR" />
	<result column="bcsbdk1" property="bcsbdk1" jdbcType="VARCHAR" />
	<result column="bcxbdk1" property="bcxbdk1" jdbcType="VARCHAR" />
	<result column="bcsbdk2" property="bcsbdk2" jdbcType="VARCHAR" />
	<result column="bcxbdk2" property="bcxbdk2" jdbcType="VARCHAR" />
	<result column="bcsbdk3" property="bcsbdk3" jdbcType="VARCHAR" />
	<result column="bcxbdk3" property="bcxbdk3" jdbcType="VARCHAR" />
	
  </resultMap>
  <sql id="Base_Column_List" >
    id, userid, data, sbdk1, sbdk1jg, xbdk1, xbdk1jg, sbdk2, sbdk2jg, xbdk2, xbdk2jg, 
    sbdk3, sbdk3jg, xbdk3, xbdk3jg, ydkcs, gzsc, qyid, dksj
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from kqgl_asso_dkmx
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from kqgl_asso_dkmx
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="cn.timer.api.bean.kqgl.PunchCardDetails" useGeneratedKeys="true" keyProperty="id">
    insert into kqgl_asso_dkmx ( userid, data, 
      sbdk1, sbdk1jg, xbdk1, 
      xbdk1jg, sbdk2, sbdk2jg, 
      xbdk2, xbdk2jg, sbdk3, 
      sbdk3jg, xbdk3, xbdk3jg, 
      ydkcs, gzsc, qyid, dksj
      )
    values (#{userid,jdbcType=INTEGER}, #{data,jdbcType=VARCHAR}, 
      #{sbdk1,jdbcType=BIGINT}, #{sbdk1jg,jdbcType=INTEGER}, #{xbdk1,jdbcType=BIGINT}, 
      #{xbdk1jg,jdbcType=INTEGER}, #{sbdk2,jdbcType=BIGINT}, #{sbdk2jg,jdbcType=INTEGER}, 
      #{xbdk2,jdbcType=BIGINT}, #{xbdk2jg,jdbcType=INTEGER}, #{sbdk3,jdbcType=BIGINT}, 
      #{sbdk3jg,jdbcType=INTEGER}, #{xbdk3,jdbcType=BIGINT}, #{xbdk3jg,jdbcType=INTEGER}, 
      #{ydkcs,jdbcType=INTEGER}, #{gzsc,jdbcType=DOUBLE}, #{qyid,jdbcType=INTEGER}, #{dksj,jdbcType=BIGINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="cn.timer.api.bean.kqgl.PunchCardDetails" useGeneratedKeys="true" keyProperty="id">
    insert into kqgl_asso_dkmx
    <trim prefix="(" suffix=")" suffixOverrides="," >
      
      <if test="userid != null" >
        userid,
      </if>
      <if test="data != null" >
        data,
      </if>
      <if test="sbdk1 != null" >
        sbdk1,
      </if>
      <if test="sbdk1jg != null" >
        sbdk1jg,
      </if>
      <if test="xbdk1 != null" >
        xbdk1,
      </if>
      <if test="xbdk1jg != null" >
        xbdk1jg,
      </if>
      <if test="sbdk2 != null" >
        sbdk2,
      </if>
      <if test="sbdk2jg != null" >
        sbdk2jg,
      </if>
      <if test="xbdk2 != null" >
        xbdk2,
      </if>
      <if test="xbdk2jg != null" >
        xbdk2jg,
      </if>
      <if test="sbdk3 != null" >
        sbdk3,
      </if>
      <if test="sbdk3jg != null" >
        sbdk3jg,
      </if>
      <if test="xbdk3 != null" >
        xbdk3,
      </if>
      <if test="xbdk3jg != null" >
        xbdk3jg,
      </if>
      <if test="ydkcs != null" >
        ydkcs,
      </if>
      <if test="gzsc != null" >
        gzsc,
      </if>
      <if test="qyid != null" >
        qyid,
      </if>
      <if test="dksj != null" >
        dksj,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      
      <if test="userid != null" >
        #{userid,jdbcType=INTEGER},
      </if>
      <if test="data != null" >
        #{data,jdbcType=VARCHAR},
      </if>
      <if test="sbdk1 != null" >
        #{sbdk1,jdbcType=BIGINT},
      </if>
      <if test="sbdk1jg != null" >
        #{sbdk1jg,jdbcType=INTEGER},
      </if>
      <if test="xbdk1 != null" >
        #{xbdk1,jdbcType=BIGINT},
      </if>
      <if test="xbdk1jg != null" >
        #{xbdk1jg,jdbcType=INTEGER},
      </if>
      <if test="sbdk2 != null" >
        #{sbdk2,jdbcType=BIGINT},
      </if>
      <if test="sbdk2jg != null" >
        #{sbdk2jg,jdbcType=INTEGER},
      </if>
      <if test="xbdk2 != null" >
        #{xbdk2,jdbcType=BIGINT},
      </if>
      <if test="xbdk2jg != null" >
        #{xbdk2jg,jdbcType=INTEGER},
      </if>
      <if test="sbdk3 != null" >
        #{sbdk3,jdbcType=BIGINT},
      </if>
      <if test="sbdk3jg != null" >
        #{sbdk3jg,jdbcType=INTEGER},
      </if>
      <if test="xbdk3 != null" >
        #{xbdk3,jdbcType=BIGINT},
      </if>
      <if test="xbdk3jg != null" >
        #{xbdk3jg,jdbcType=INTEGER},
      </if>
      <if test="ydkcs != null" >
        #{ydkcs,jdbcType=INTEGER},
      </if>
      <if test="gzsc != null" >
        #{gzsc,jdbcType=DOUBLE},
      </if>
      <if test="qyid != null" >
        #{qyid,jdbcType=INTEGER},
      </if>
      <if test="dksj != null" >
        #{dksj,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="cn.timer.api.bean.kqgl.PunchCardDetails" >
    update kqgl_asso_dkmx
    <set >
      <if test="userid != null" >
        userid = #{userid,jdbcType=INTEGER},
      </if>
      <if test="data != null" >
        data = #{data,jdbcType=VARCHAR},
      </if>
      <if test="sbdk1 != null" >
        sbdk1 = #{sbdk1,jdbcType=BIGINT},
      </if>
      <if test="sbdk1jg != null" >
        sbdk1jg = #{sbdk1jg,jdbcType=INTEGER},
      </if>
      <if test="xbdk1 != null" >
        xbdk1 = #{xbdk1,jdbcType=BIGINT},
      </if>
      <if test="xbdk1jg != null" >
        xbdk1jg = #{xbdk1jg,jdbcType=INTEGER},
      </if>
      <if test="sbdk2 != null" >
        sbdk2 = #{sbdk2,jdbcType=BIGINT},
      </if>
      <if test="sbdk2jg != null" >
        sbdk2jg = #{sbdk2jg,jdbcType=INTEGER},
      </if>
      <if test="xbdk2 != null" >
        xbdk2 = #{xbdk2,jdbcType=BIGINT},
      </if>
      <if test="xbdk2jg != null" >
        xbdk2jg = #{xbdk2jg,jdbcType=INTEGER},
      </if>
      <if test="sbdk3 != null" >
        sbdk3 = #{sbdk3,jdbcType=BIGINT},
      </if>
      <if test="sbdk3jg != null" >
        sbdk3jg = #{sbdk3jg,jdbcType=INTEGER},
      </if>
      <if test="xbdk3 != null" >
        xbdk3 = #{xbdk3,jdbcType=BIGINT},
      </if>
      <if test="xbdk3jg != null" >
        xbdk3jg = #{xbdk3jg,jdbcType=INTEGER},
      </if>
      <if test="ydkcs != null" >
        ydkcs = #{ydkcs,jdbcType=INTEGER},
      </if>
      <if test="gzsc != null" >
        gzsc = #{gzsc,jdbcType=DOUBLE},
      </if>
      <if test="qyid != null" >
        qyid = #{qyid,jdbcType=INTEGER},
      </if>
      <if test="dksj != null" >
        dksj = #{dksj,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.timer.api.bean.kqgl.PunchCardDetails" >
    update kqgl_asso_dkmx
    set userid = #{userid,jdbcType=INTEGER},
      data = #{data,jdbcType=VARCHAR},
      sbdk1 = #{sbdk1,jdbcType=BIGINT},
      sbdk1jg = #{sbdk1jg,jdbcType=INTEGER},
      xbdk1 = #{xbdk1,jdbcType=BIGINT},
      xbdk1jg = #{xbdk1jg,jdbcType=INTEGER},
      sbdk2 = #{sbdk2,jdbcType=BIGINT},
      sbdk2jg = #{sbdk2jg,jdbcType=INTEGER},
      xbdk2 = #{xbdk2,jdbcType=BIGINT},
      xbdk2jg = #{xbdk2jg,jdbcType=INTEGER},
      sbdk3 = #{sbdk3,jdbcType=BIGINT},
      sbdk3jg = #{sbdk3jg,jdbcType=INTEGER},
      xbdk3 = #{xbdk3,jdbcType=BIGINT},
      xbdk3jg = #{xbdk3jg,jdbcType=INTEGER},
      ydkcs = #{ydkcs,jdbcType=INTEGER},
      gzsc = #{gzsc,jdbcType=DOUBLE},
      qyid = #{qyid,jdbcType=INTEGER},
      dksj = #{dksj,jdbcType=BIGINT}
    where id = #{id,jdbcType=INTEGER}
  </update>
  
  <update id="ModifyPunchDetails" parameterType="cn.timer.api.bean.kqgl.PunchCardDetails" >
    update kqgl_asso_dkmx
    set sbdk1 = #{sbdk1,jdbcType=BIGINT},
      sbdk1jg = #{sbdk1jg,jdbcType=INTEGER},
      xbdk1 = #{xbdk1,jdbcType=BIGINT},
      xbdk1jg = #{xbdk1jg,jdbcType=INTEGER},
      sbdk2 = #{sbdk2,jdbcType=BIGINT},
      sbdk2jg = #{sbdk2jg,jdbcType=INTEGER},
      xbdk2 = #{xbdk2,jdbcType=BIGINT},
      xbdk2jg = #{xbdk2jg,jdbcType=INTEGER},
      sbdk3 = #{sbdk3,jdbcType=BIGINT},
      sbdk3jg = #{sbdk3jg,jdbcType=INTEGER},
      xbdk3 = #{xbdk3,jdbcType=BIGINT},
      xbdk3jg = #{xbdk3jg,jdbcType=INTEGER},
      ydkcs = #{ydkcs,jdbcType=INTEGER},
      gzsc = #{gzsc,jdbcType=DOUBLE}
    where id = #{id,jdbcType=INTEGER}
  </update>
  
  <select id="selectAttendanceDays" resultMap="BaseResultMap">
  		select * from kqgl_asso_dkmx dkmx
		where dkmx.userid = #{userid,jdbcType=INTEGER}
		and dkmx.dksj &gt;= #{start,jdbcType=BIGINT}
		and dkmx.dksj &lt;= #{end,jdbcType=BIGINT}
		and dkmx.qyid = #{qyid,jdbcType=INTEGER}
  </select>
  
  <select id="SingleAttendanceDays" resultMap="BaseResultMap">
  		select * from kqgl_asso_dkmx dkmx
		where dkmx.userid = #{userid,jdbcType=INTEGER}
		and dkmx.dksj &gt;= #{start,jdbcType=BIGINT}
		and dkmx.dksj &lt;= #{end,jdbcType=BIGINT}
  </select>
  
  <select id="SelectAttendanceDetails" resultMap="BaseResultMap">
  		select DISTINCT info.`name` as username , 
			dkjl.attdate, 
			bcsz.`name` as bcname,
			bcsz.sbdk1 as bcsbdk1,
			bcsz.xbdk1 as bcxbdk1,
			bcsz.sbdk2 as bcsbdk2,
			bcsz.xbdk2 as bcxbdk2,
			bcsz.sbdk3 as bcsbdk3,
			bcsz.xbdk3 as bcxbdk3,
			bmgw.dept,
			 bmgw.post,
			dkmx.* 
		from kqgl_asso_dkmx dkmx 
		LEFT JOIN yggl_main_emp as info on info.emp_num = dkmx.userid and info.org_code = #{qyid,jdbcType=INTEGER}
		LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
				 from zzgl_bmgw_m m 
				 left join zzgl_bmgw_m um on um.id = m.up_id  
			) as bmgw on bmgw.mid = info.bmgw_id
		LEFT JOIN kqgl_asso_dkjl as dkjl on dkjl.dkmxid = dkmx.id
		LEFT JOIN kqgl_asso_bcsz as bcsz on bcsz.id = dkjl.bcid
		where dkmx.qyid = #{qyid,jdbcType=INTEGER}
		and dkmx.dksj &gt;= #{start,jdbcType=BIGINT}
		and dkmx.dksj &lt;= #{end,jdbcType=BIGINT}
  </select>
  
  <select id="QueryAttendanceDetails" resultMap="BaseResultMap">
  		select DISTINCT info.`name` as username , 
			dkjl.attdate, 
			bcsz.`name` as bcname,
			bcsz.sbdk1 as bcsbdk1,
			bcsz.xbdk1 as bcxbdk1,
			bcsz.sbdk2 as bcsbdk2,
			bcsz.xbdk2 as bcxbdk2,
			bcsz.sbdk3 as bcsbdk3,
			bcsz.xbdk3 as bcxbdk3,
			bmgw.dept,
			 bmgw.post,
			dkmx.* 
		from kqgl_asso_dkmx dkmx 
		LEFT JOIN yggl_main_emp as info on info.emp_num = dkmx.userid and info.org_code = #{qyid,jdbcType=INTEGER}
		LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
				 from zzgl_bmgw_m m 
				 left join zzgl_bmgw_m um on um.id = m.up_id  
			) as bmgw on bmgw.mid = info.bmgw_id
		LEFT JOIN kqgl_asso_dkjl as dkjl on dkjl.dkmxid = dkmx.id
		LEFT JOIN kqgl_asso_bcsz as bcsz on bcsz.id = dkjl.bcid
		where dkmx.qyid = #{qyid,jdbcType=INTEGER}
		<if test="start != ''" >
			and dkmx.dksj &gt;= #{start,jdbcType=VARCHAR}
		</if>
		<if test="end != ''" >
			and dkmx.dksj &lt;= #{end,jdbcType=VARCHAR}
		</if>
		<if test="text != ''" >
			and (info.`name` like CONCAT('%',#{text,jdbcType=VARCHAR},'%') or dkmx.userid = #{text,jdbcType=VARCHAR})
		</if>
		
  </select>
  
  <select id="selectWorkingHours" resultType="java.lang.Integer" >
  	select IFNULL(SUM(dkmx.gzsc),0) from kqgl_asso_dkmx dkmx 
	where dkmx.userid = #{userid,jdbcType=INTEGER}
	and dkmx.dksj &gt;= #{start,jdbcType=VARCHAR}
	and dkmx.dksj &lt;= #{end,jdbcType=VARCHAR}
  </select>
  
  <select id="selectNoScheduling" resultMap="BaseResultMap">
	  select * from kqgl_asso_dkmx dkmx
		where dkmx.id in (select dkjl.dkmxid from kqgl_asso_dkjl dkjl
		where dkjl.attime &gt;= #{start,jdbcType=VARCHAR}
		and dkjl.attime &lt;= #{end,jdbcType=VARCHAR}
		and dkjl.user_id = #{userid,jdbcType=INTEGER}
		and dkjl.bcid = 0
		GROUP BY dkjl.dkmxid);
  </select>
  
</mapper>