9e4219e01f0a607a546f8b7d5b6347b8d735ee68.svn-base 5.07 KB
<?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="com.thinkgem.jeesite.modules.ycsl.dao.YcslJbxxDao">
    
	<sql id="ycslJbxxColumns">
		a.id AS "id",
		a.proid AS "proid",
		a.bdcdyh AS "bdcdyh",
		a.fybh AS "fybh",
		a.zl AS "zl",
		a.jzmj AS "jzmj",
		a.tnmj AS "tnmj",
		a.szc AS "szc",
		a.zcs AS "zcs",
		a.zrzh AS "zrzh",
		a.dyh AS "dyh",
		a.fjh AS "fjh",
		a.fwlx AS "fwlx",
		a.fwjg AS "fwjg",
		a.tdxz AS "tdxz",
		a.tdyt AS "tdyt",
		a.fwyt AS "fwyt",
		a.fwxz AS "fwxz",
		 a.cqzh AS "cqzh",
		a.fwdj AS "fwdj",
		a.fwzj AS "fwzj",
		a.zt AS "zt",
		a.htbh AS "htbh",
		a.wsxx AS "wsxx",
		a.qyxx AS "qyxx",
		a.wsbz AS "wsbz",
		a.dept AS "dept",
		a.qszyfs as "qszyfs",
		a.xmmc AS "xmmc",
		a.jzwmc AS "jzwmc",
		a.zdzl AS "zdzl",
		a.jgsj AS "jgsj",
		a.del_flag AS "delFlag",
		a.create_by AS "createBy.id",
		a.create_date AS "createDate",
		a.update_by AS "updateBy.id",
		a.update_date AS "updateDate"
	</sql>
	
	<sql id="ycslJbxxJoins">
	</sql>
    
	<select id="get" resultType="YcslJbxx">
		SELECT 
			<include refid="ycslJbxxColumns"/>
		FROM ycsl_jbxx a
		<include refid="ycslJbxxJoins"/>
		WHERE a.id = #{id}
	</select>
	
	<select id="getByBdcdyh" resultType="YcslJbxx">
		SELECT 
			<include refid="ycslJbxxColumns"/>
		FROM ycsl_jbxx a
		<include refid="ycslJbxxJoins"/>
		WHERE a.bdcdyh = #{bdcdyh}
		and a.del_flag='0'
		and a.zt = 'true'
	</select>
	
	<select id="getByProid" resultType="YcslJbxx">
		SELECT 
			<include refid="ycslJbxxColumns"/>
		FROM ycsl_jbxx a
		<include refid="ycslJbxxJoins"/>
		WHERE a.proid = #{proid}
		and a.del_flag='0'
		and a.zt = 'true'
	</select>
	
	<select id="getbdcdyh" resultType="YcslJbxx">
		SELECT 
			<include refid="ycslJbxxColumns"/>
		FROM ycsl_jbxx a
		<include refid="ycslJbxxJoins"/>
		WHERE a.bdcdyh = #{bdcdyh}
		and a.del_flag='0'
		and a.zt is not null
		and a.zt != 'end'
	</select>
	
	<select id="findList" resultType="YcslJbxx">
		SELECT 
			<include refid="ycslJbxxColumns"/>
		FROM ycsl_jbxx a
		<include refid="ycslJbxxJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
			and a.zt is not null
			<if test= "zt != null and zt != ''">
				AND a.zt != 'end'
			</if>
			<if test= "bdcdyh != null and bdcdyh != ''">
				AND a.bdcdyh = #{bdcdyh}
			</if>
			<if test= "dept != null and dept != ''">
				AND a.dept != #{dept}
			</if>
		</where>
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
				ORDER BY a.update_date DESC
			</otherwise>
		</choose>
	</select>
	
	<select id="findAllList" resultType="YcslJbxx">
		SELECT 
			<include refid="ycslJbxxColumns"/>
		FROM ycsl_jbxx a
		<include refid="ycslJbxxJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
		</where>		
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
				ORDER BY a.update_date DESC
			</otherwise>
		</choose>
	</select>
	
	<insert id="insert">
		INSERT INTO ycsl_jbxx(
			id,
			proid,
			bdcdyh,
			fybh,
			zl,
			jzmj,
			tnmj,
			szc,
			zcs,
			zrzh,
			dyh,
			fjh,
			fwlx,
			fwjg,
			tdxz,
			tdyt,
			fwyt,
			fwxz,
			cqzh,
			fwdj,
			fwzj,
			zt,
			htbh,
			wsxx,
			qyxx,
			wsbz,
			dept,
			qszyfs,
			xmmc,
			jzwmc,
			zdzl,
			jgsj,
			del_flag,
			create_by,
			create_date,
			update_by,
			update_date
		) VALUES (
			#{id},
			#{proid},
			#{bdcdyh},
			#{fybh},
			#{zl},
			#{jzmj},
			#{tnmj},
			#{szc},
			#{zcs},
			#{zrzh},
			#{dyh},
			#{fjh},
			#{fwlx},
			#{fwjg},
			#{tdxz},
			#{tdyt},
			#{fwyt},
			#{fwxz},
			#{cqzh},
			#{fwdj},
			#{fwzj},
			#{zt},
			#{htbh},
			#{wsxx},
			#{qyxx},
			#{wsbz},
			#{dept},
			#{qszyfs},
			#{xmmc},
			#{jzwmc},
			#{zdzl},
			#{jgsj},
			#{DEL_FLAG_NORMAL},
			#{createBy.id},
			#{createDate},
			#{updateBy.id},
			#{updateDate}
		)
	</insert>
	
	<update id="update">
		UPDATE ycsl_jbxx SET 	
			proid = #{proid},
			bdcdyh = #{bdcdyh},
			fybh = #{fybh},
			zl = #{zl},
			jzmj = #{jzmj},
			tnmj = #{tnmj},
			szc = #{szc},
			zcs = #{zcs},
			zrzh = #{zrzh},
			dyh = #{dyh},
			fjh = #{fjh},
			fwlx = #{fwlx},
			fwjg = #{fwjg},
			tdxz = #{tdxz},
			tdyt = #{tdyt},
			fwyt = #{fwyt},
			fwxz = #{fwxz},
			cqzh = #{cqzh},
			fwdj = #{fwdj},
			fwzj = #{fwzj},
			zt = #{zt},
			htbh = #{htbh},
			wsxx = #{wsxx},
			qyxx = #{qyxx},
			wsbz = #{wsbz},
			dept = #{dept},
			qszyfs = #{qszyfs},
			xmmc = #{xmmc},
			jzwmc = #{jzwmc},
			zdzl = #{zdzl},
			jgsj = #{jgsj},
			update_by = #{updateBy.id},
			update_date = #{updateDate}
		WHERE id = #{id}
	</update>
	
	<update id="delete">
		UPDATE ycsl_jbxx SET 
			del_flag = #{DEL_FLAG_DELETE}
		WHERE id = #{id}
	</update>
	
	
	<update id="delEmpty">
		UPDATE ycsl_jbxx SET 
			del_flag = '1'
		WHERE zt is null
		and del_flag = '0'
	</update>
	
	<select id="findEmpty" resultType="YcslJbxx">
		SELECT 
			<include refid="ycslJbxxColumns"/>
		FROM ycsl_jbxx a
		<include refid="ycslJbxxJoins"/>
		<where>
			and a.zt is null 
			and a.del_flag = '0'
		</where>
	</select>
</mapper>