AttendanceWeeklySchMapper.xml 6.5 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
<?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.AttendanceWeeklySchMapper" >
  <resultMap id="BaseResultMap" type="cn.timer.api.bean.kqgl.AttendanceWeeklySch" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="kqzid" property="kqzid" jdbcType="INTEGER" />
    <result column="type" property="type" jdbcType="INTEGER" />
    <result column="bcid" property="bcid" jdbcType="INTEGER" />
    
    <result column="bcname" property="bcname" jdbcType="VARCHAR" />
    <result column="sbdk1" property="sbdk1" jdbcType="VARCHAR" />
    <result column="xbdk1" property="xbdk1" jdbcType="VARCHAR" />
    <result column="sbdk2" property="sbdk2" jdbcType="VARCHAR" />
    <result column="xbdk2" property="xbdk2" jdbcType="VARCHAR" />
    <result column="sbdk3" property="sbdk3" jdbcType="VARCHAR" />
    <result column="xbdk3" property="xbdk3" jdbcType="VARCHAR" />
    <result column="weektime" property="weektime" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, kqzid, type, bcid
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from kqgl_asso_zhoupaiban
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from kqgl_asso_zhoupaiban
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="cn.timer.api.bean.kqgl.AttendanceWeeklySch" >
    insert into kqgl_asso_zhoupaiban (id, kqzid, type, 
      bcid)
    values (#{id,jdbcType=INTEGER}, #{kqzid,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, 
      #{bcid,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="cn.timer.api.bean.kqgl.AttendanceWeeklySch" >
    insert into kqgl_asso_zhoupaiban
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="kqzid != null" >
        kqzid,
      </if>
      <if test="type != null" >
        type,
      </if>
      <if test="bcid != null" >
        bcid,
      </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="type != null" >
        #{type,jdbcType=INTEGER},
      </if>
      <if test="bcid != null" >
        #{bcid,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="cn.timer.api.bean.kqgl.AttendanceWeeklySch" >
    update kqgl_asso_zhoupaiban
    <set >
      <if test="kqzid != null" >
        kqzid = #{kqzid,jdbcType=INTEGER},
      </if>
      <if test="type != null" >
        type = #{type,jdbcType=INTEGER},
      </if>
      <if test="bcid != null" >
        bcid = #{bcid,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.timer.api.bean.kqgl.AttendanceWeeklySch" >
    update kqgl_asso_zhoupaiban
    set kqzid = #{kqzid,jdbcType=INTEGER},
      type = #{type,jdbcType=INTEGER},
      bcid = #{bcid,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
  
  
  <insert id="insertKqglAssoZhoupaibanList" parameterType="java.util.List" >
	    insert into kqgl_asso_zhoupaiban (kqzid, type, bcid)
	    <foreach collection="list" item="item" index="index" open="values " close="" separator=",">
	   	(
	      <if test="item.kqzid != null" >
	        #{item.kqzid,jdbcType=INTEGER},
	      </if>
	      <if test="item.type != null" >
	        #{item.type,jdbcType=INTEGER},
	      </if>
	      <if test="item.bcid != null" >
	        #{item.bcid,jdbcType=INTEGER}
	      </if>
	      )
	    </foreach>
   </insert>
   
   <delete id="deleteByPrimaryBykqzid" parameterType="java.lang.Integer" >
    delete from kqgl_asso_zhoupaiban
    where kqzid = #{kqzid,jdbcType=INTEGER}
  </delete>
  
  <select id="selectAttWeeklySchedulingByKqzid" resultMap="BaseResultMap">
  		select * from kqgl_asso_zhoupaiban zpb
			where zpb.kqzid = #{kqzid,jdbcType=INTEGER}
			and zpb.bcid = 0 
  </select>
  
  <select id="selectAttWeeklySchByKqzid" resultMap="BaseResultMap">
  		select zpb.*,bcsz.`name` bcname,bcsz.sbdk1,bcsz.xbdk1,bcsz.sbdk2,bcsz.xbdk2,bcsz.sbdk3,bcsz.xbdk3,
				case zpb.type WHEN  1 then '周一' WHEN  2 then '周二' WHEN  3 then '周三' WHEN  4 then '周四' WHEN  5 then '周五' WHEN  6 then '周六' 
						else '周日'  end as weektime
				 from kqgl_asso_zhoupaiban zpb
				LEFT JOIN kqgl_asso_bcsz as bcsz on bcsz.id = zpb.bcid
				where zpb.kqzid = #{kqzid,jdbcType=INTEGER}
  </select>
  
  
  <select id="selectAttendanceMadeByUserid" resultMap="BaseResultMap">
  			select zpb.*,
				case zpb.type
				WHEN 1 then '星期一' 
				WHEN 2 then '星期二' 
				WHEN 3 then '星期三' 
				WHEN 4 then '星期四' 
				WHEN 5 then '星期五' 
				WHEN 6 then '星期六' 
				WHEN 7 then '星期日' 
				else '自由工时'  
				end as wekmc
			from kqgl_asso_zhoupaiban zpb
		where zpb.kqzid = (select yhkqz.kqzid from kqgl_asso_yhkqz yhkqz
lal committed
145 146
		where yhkqz.userid = #{userid} and yhkqz.qyid = #{qyid})
		and zpb.bcid != 0
yuquan.zhu committed
147 148
  </select>
  
lal committed
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
  <select id="selectAttendanceMadeByZhou" resultMap="BaseResultMap">
  			select zpb.*,
				case zpb.type
				WHEN 1 then '星期一' 
				WHEN 2 then '星期二' 
				WHEN 3 then '星期三' 
				WHEN 4 then '星期四' 
				WHEN 5 then '星期五' 
				WHEN 6 then '星期六' 
				WHEN 7 then '星期日' 
				else '自由工时'  
				end as wekmc
			from kqgl_asso_zhoupaiban zpb
		where zpb.kqzid = (select yhkqz.kqzid from kqgl_asso_yhkqz yhkqz
		where yhkqz.userid = #{userid} and yhkqz.qyid = #{qyid})
  </select>
  
yuquan.zhu committed
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
  <select id="selectZhouDetail" resultMap="BaseResultMap">
  		select * from kqgl_asso_zhoupaiban zpb
			where zpb.kqzid = #{kqzid,jdbcType=INTEGER}
			and zpb.type = #{type,jdbcType=INTEGER}
			and zpb.bcid != 0
  </select>
  
   <select id="WeeklyFreeRoster" resultMap="BaseResultMap">
  		select * from kqgl_asso_zhoupaiban zpb
			where zpb.kqzid = #{kqzid,jdbcType=INTEGER}
			and zpb.bcid = 0 
			and zpb.type = #{type,jdbcType=INTEGER}
  </select>
  
  <select id="selectFreeWorkingHours" resultMap="BaseResultMap">
  		select * from kqgl_asso_zhoupaiban zpb
			where zpb.kqzid = #{kqzid,jdbcType=INTEGER}
			and zpb.type = #{type,jdbcType=INTEGER}
			and zpb.bcid = 0
  </select>
  
</mapper>