KqglMainKqzMapper.xml 13.7 KB
Newer Older
ilal 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
<?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.KqglMainKqzMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.kqmk.KqglMainKqz" >
                <id column="id" property="id" />
                <result column="name" property="name" />
                <result column="kqbz" property="kqbz" />
                <result column="pbfs" property="pbfs" />
                <result column="qyid" property="qyid" />
                <result column="is_fdjjr" property="isFdjjr" />
                <result column="kqkssj_time" property="kqkssjTime" />
                <result column="zsgzsc" property="zsgzsc" />
                <result column="zcgzsc" property="zcgzsc" />
                <result column="jbzdsc" property="jbzdsc" />
                <result column="is_dqtx" property="isDqtx" />
                <result column="txry" property="txry" />
                <result column="txfs" property="txfs" />
                <result column="txxhts" property="txxhts" />
                <result column="txsj_time" property="txsjTime" />
                <result column="tsfs" property="tsfs" />
                <result column="is_wpbsdk" property="isWpbsdk" />
                <result column="sybc" property="sybc" />
                <result column="is_xzbcdk" property="isXzbcdk" />
                <result column="is_wq" property="isWq" />
ilal committed
27
                <result column="overtime_rules_id" property="overtimeRulesId" />
ilal committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
    </resultMap>
    
    <resultMap id="AuxiliaryMap" type="cn.timer.api.dto.kqmk.KqglMainKqzDto" >
                <id column="id" property="id" />
                <result column="name" property="name" />
                <result column="kqbz" property="kqbz" />
                <result column="pbfs" property="pbfs" />
                <result column="qyid" property="qyid" />
                <result column="is_fdjjr" property="isFdjjr" />
                <result column="kqkssj_time" property="kqkssjTime" />
                <result column="zsgzsc" property="zsgzsc" />
                <result column="zcgzsc" property="zcgzsc" />
                <result column="jbzdsc" property="jbzdsc" />
                <result column="is_dqtx" property="isDqtx" />
                <result column="txry" property="txry" />
                <result column="txfs" property="txfs" />
                <result column="txxhts" property="txxhts" />
                <result column="txsj_time" property="txsjTime" />
                <result column="tsfs" property="tsfs" />
                <result column="is_wpbsdk" property="isWpbsdk" />
                <result column="sybc" property="sybc" />
                <result column="is_xzbcdk" property="isXzbcdk" />
                <result column="is_wq" property="isWq" />
ilal committed
51
                <result column="overtime_rules_id" property="overtimeRulesId" />
ilal committed
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
                
                <result column="kqznum" property="kqznum" />
			    <result column="pbfsnm" property="pbfsnm" />
			    <result column="dkfs" property="dkfs" />
			    <result column="kqjid" property="kqjid" />
    </resultMap>

    <sql id="Base_Column_List">
                id,
                name,
                kqbz,
                pbfs,
                qyid,
                is_fdjjr,
                kqkssj_time,
                zsgzsc,
                zcgzsc,
                jbzdsc,
                is_dqtx,
                txry,
                txfs,
                txxhts,
                txsj_time,
                tsfs,
                is_wpbsdk,
                sybc,
                is_xzbcdk,
ilal committed
79 80
                is_wq,
                overtime_rules_id
ilal committed
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
    </sql>
    
    <sql id="Base_Column_List_Alias">
                id KqglMainKqz_id,
                name KqglMainKqz_name,
                kqbz KqglMainKqz_kqbz,
                pbfs KqglMainKqz_pbfs,
                qyid KqglMainKqz_qyid,
                is_fdjjr KqglMainKqz_is_fdjjr,
                kqkssj_time KqglMainKqz_kqkssj_time,
                zsgzsc KqglMainKqz_zsgzsc,
                zcgzsc KqglMainKqz_zcgzsc,
                jbzdsc KqglMainKqz_jbzdsc,
                is_dqtx KqglMainKqz_is_dqtx,
                txry KqglMainKqz_txry,
                txfs KqglMainKqz_txfs,
                txxhts KqglMainKqz_txxhts,
                txsj_time KqglMainKqz_txsj_time,
                tsfs KqglMainKqz_tsfs,
                is_wpbsdk KqglMainKqz_is_wpbsdk,
                sybc KqglMainKqz_sybc,
                is_xzbcdk KqglMainKqz_is_xzbcdk,
ilal committed
103 104
                is_wq KqglMainKqz_is_wq,
                overtime_rules_id KqglMainKqz_overtime_rules_id
ilal committed
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
    </sql>
    
    <sql id="Base_Column_List_a">
                a.id,
                a.name,
                a.kqbz,
                a.pbfs,
                a.qyid,
                a.is_fdjjr,
                a.kqkssj_time,
                a.zsgzsc,
                a.zcgzsc,
                a.jbzdsc,
                a.is_dqtx,
                a.txry,
                a.txfs,
                a.txxhts,
                a.txsj_time,
                a.tsfs,
                a.is_wpbsdk,
                a.sybc,
                a.is_xzbcdk,
ilal committed
127 128
                a.is_wq,
                a.overtime_rules_id
ilal committed
129 130 131 132 133 134 135 136 137 138
    </sql>
    
    <select id="selectAttGroupMachineByQyid" resultMap="AuxiliaryMap">
		select 
			<include refid="Base_Column_List_a" />,
			 kqzdkfs.dkfsid as kqjid 
		 from kqgl_main_kqz a
		 LEFT JOIN kqgl_asso_kqzdkfs as kqzdkfs on kqzdkfs.kqz_id = a.id and kqzdkfs.type = 1 and kqzdkfs.state = 1
		 where a.qyid = #{qyid,jdbcType=INTEGER}
	</select>
ilal committed
139 140 141 142 143 144
	
	<select id="getAttendanceGroupInformationByUserid" resultMap="BaseResultMap">
	  	select * from kqgl_main_kqz kqz
			where kqz.id = (select yhkqz.kqzid from kqgl_asso_yhkqz yhkqz
			where yhkqz.userid = #{userid,jdbcType=INTEGER} and yhkqz.qyid = #{qyid,jdbcType=INTEGER})
	  </select>
ilal committed
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
	  
	  
	  <select id="selectPageByQueryKqglMain" resultMap="AuxiliaryMap">
	    select kqz.*,
		    	case kqz.pbfs 
				WHEN  '1' then '固定排班' 
				WHEN  '2' then '排班制' 
				else '自由工时'  
				end as pbfsnm,
				znm.kqznum,
				dkfs.type
			from kqgl_main_kqz kqz
		LEFT JOIN (select count(yhkqz.kqzid) as kqznum,
						yhkqz.kqzid as kqzid 
					from kqgl_asso_yhkqz yhkqz 
					where yhkqz.qyid = #{param.orgCode} 
					GROUP BY yhkqz.kqzid) as znm on znm.kqzid = kqz.id
		LEFT JOIN (select kqzdkfs.kqz_id as kqzId,kqzdkfs.type as type from kqgl_asso_kqzdkfs kqzdkfs 
				where kqzdkfs.qyid = #{param.orgCode} ) as dkfs on dkfs.kqzId = kqz.id
			where 1=1
			and kqz.qyid = #{param.orgCode} 
			<if test="param.query != null and param.query != ''">
				and kqz.`name` like CONCAT('%',#{param.query},'%')
			</if>
	  </select>
ilal committed
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

	<!-- 

    <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglMainKqz">
        INSERT INTO kqgl_main_kqz
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != name'>
                        name,
                        </if>
                        <if test ='null != kqbz'>
                        kqbz,
                        </if>
                        <if test ='null != pbfs'>
                        pbfs,
                        </if>
                        <if test ='null != qyid'>
                        qyid,
                        </if>
                        <if test ='null != isFdjjr'>
                        is_fdjjr,
                        </if>
                        <if test ='null != kqkssjTime'>
                        kqkssj_time,
                        </if>
                        <if test ='null != zsgzsc'>
                        zsgzsc,
                        </if>
                        <if test ='null != zcgzsc'>
                        zcgzsc,
                        </if>
                        <if test ='null != jbzdsc'>
                        jbzdsc,
                        </if>
                        <if test ='null != isDqtx'>
                        is_dqtx,
                        </if>
                        <if test ='null != txry'>
                        txry,
                        </if>
                        <if test ='null != txfs'>
                        txfs,
                        </if>
                        <if test ='null != txxhts'>
                        txxhts,
                        </if>
                        <if test ='null != txsjTime'>
                        txsj_time,
                        </if>
                        <if test ='null != tsfs'>
                        tsfs,
                        </if>
                        <if test ='null != isWpbsdk'>
                        is_wpbsdk,
                        </if>
                        <if test ='null != sybc'>
                        sybc,
                        </if>
                        <if test ='null != isXzbcdk'>
                        is_xzbcdk,
                        </if>
                        <if test ='null != isWq'>
ilal committed
231 232 233 234
                        is_wq,
                        </if>
                        <if test ='null != overtimeRulesId'>
                        overtime_rules_id
ilal committed
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
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != name'>
                        #{name},
                        </if>
                        <if test ='null != kqbz'>
                        #{kqbz},
                        </if>
                        <if test ='null != pbfs'>
                        #{pbfs},
                        </if>
                        <if test ='null != qyid'>
                        #{qyid},
                        </if>
                        <if test ='null != isFdjjr'>
                        #{isFdjjr},
                        </if>
                        <if test ='null != kqkssjTime'>
                        #{kqkssjTime},
                        </if>
                        <if test ='null != zsgzsc'>
                        #{zsgzsc},
                        </if>
                        <if test ='null != zcgzsc'>
                        #{zcgzsc},
                        </if>
                        <if test ='null != jbzdsc'>
                        #{jbzdsc},
                        </if>
                        <if test ='null != isDqtx'>
                        #{isDqtx},
                        </if>
                        <if test ='null != txry'>
                        #{txry},
                        </if>
                        <if test ='null != txfs'>
                        #{txfs},
                        </if>
                        <if test ='null != txxhts'>
                        #{txxhts},
                        </if>
                        <if test ='null != txsjTime'>
                        #{txsjTime},
                        </if>
                        <if test ='null != tsfs'>
                        #{tsfs},
                        </if>
                        <if test ='null != isWpbsdk'>
                        #{isWpbsdk},
                        </if>
                        <if test ='null != sybc'>
                        #{sybc},
                        </if>
                        <if test ='null != isXzbcdk'>
                        #{isXzbcdk},
                        </if>
                        <if test ='null != isWq'>
ilal committed
293 294 295 296
                        #{isWq},
                        </if>
                        <if test ='null != overtimeRulesId'>
                        #{overtimeRulesId}
ilal committed
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
                        </if>
        </trim>
    </insert>

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

    <update id="update" parameterType="cn.timer.api.bean.kqmk.KqglMainKqz">
        UPDATE kqgl_main_kqz
        <set>
                    <if test ='null != name'>name = #{name},</if>
                    <if test ='null != kqbz'>kqbz = #{kqbz},</if>
                    <if test ='null != pbfs'>pbfs = #{pbfs},</if>
                    <if test ='null != qyid'>qyid = #{qyid},</if>
                    <if test ='null != isFdjjr'>is_fdjjr = #{isFdjjr},</if>
                    <if test ='null != kqkssjTime'>kqkssj_time = #{kqkssjTime},</if>
                    <if test ='null != zsgzsc'>zsgzsc = #{zsgzsc},</if>
                    <if test ='null != zcgzsc'>zcgzsc = #{zcgzsc},</if>
                    <if test ='null != jbzdsc'>jbzdsc = #{jbzdsc},</if>
                    <if test ='null != isDqtx'>is_dqtx = #{isDqtx},</if>
                    <if test ='null != txry'>txry = #{txry},</if>
                    <if test ='null != txfs'>txfs = #{txfs},</if>
                    <if test ='null != txxhts'>txxhts = #{txxhts},</if>
                    <if test ='null != txsjTime'>txsj_time = #{txsjTime},</if>
                    <if test ='null != tsfs'>tsfs = #{tsfs},</if>
                    <if test ='null != isWpbsdk'>is_wpbsdk = #{isWpbsdk},</if>
                    <if test ='null != sybc'>sybc = #{sybc},</if>
                    <if test ='null != isXzbcdk'>is_xzbcdk = #{isXzbcdk},</if>
ilal committed
327 328
                    <if test ='null != isWq'>is_wq = #{isWq},</if>
                    <if test ='null != overtimeRulesId'>overtime_rules_id = #{overtimeRulesId}</if>
ilal committed
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
        </set>
        WHERE id = #{id}
    </update>


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

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

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

	 -->

</mapper>