YcslSlsqDao.xml 2.89 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.reg.dao.bus.YcslSlsqDao">
    
	<sql id="ycslSlsqColumns">
		a.id AS "id",
		a.wwywh AS "wwywh",
		a.ywh AS "ywh",
		a.lcdm AS "lcdm",
		a.lcxlmc AS "lcxlmc",
		a.bdclb AS "bdclb",
		a.djjg AS "djjg",
		a.djjgmc AS "djjgmc",
		a.bsdt AS "bsdt",
		a.bsdtmc AS "bsdtmc",
		a.tjsj AS "tjsj",
		a.sqryhmc AS "sqryhmc",
		a.bdcqzh AS "bdcqzh",
		a.create_by AS "createBy.id",
		a.create_date AS "createDate",
		a.update_by AS "updateBy.id",
		a.update_date AS "updateDate",
		a.remarks AS "remarks",
		a.del_flag AS "delFlag"
	</sql>
	
	<sql id="ycslSlsqJoins">
	</sql>
    
	<select id="get" resultType="YcslSlsq">
		SELECT 
			<include refid="ycslSlsqColumns"/>
		FROM ycsl_slsq a
		<include refid="ycslSlsqJoins"/>
		WHERE a.id = #{id}
	</select>
	
	<select id="findList" resultType="YcslSlsq">
		SELECT 
			<include refid="ycslSlsqColumns"/>
		FROM ycsl_slsq a
		<include refid="ycslSlsqJoins"/>
		<where>
			<if test="ywh != null and ywh != ''">
				AND a.ywh = #{ywh}
			</if>
			AND 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>
	
	<select id="findAllList" resultType="YcslSlsq">
		SELECT 
			<include refid="ycslSlsqColumns"/>
		FROM ycsl_slsq a
		<include refid="ycslSlsqJoins"/>
		<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_slsq(
			id,
			wwywh,
			ywh,
			lcdm,
			lcxlmc,
			bdclb,
			djjg,
			djjgmc,
			bsdt,
			bsdtmc,
			tjsj,
			sqryhmc,
			bdcqzh,
			create_by,
			create_date,
			update_by,
			update_date,
			remarks,
			del_flag
		) VALUES (
			#{id},
			#{wwywh},
			#{ywh},
			#{lcdm},
			#{lcxlmc},
			#{bdclb},
			#{djjg},
			#{djjgmc},
			#{bsdt},
			#{bsdtmc},
			#{tjsj},
			#{sqryhmc},
			#{bdcqzh},
			#{createBy.id},
			#{createDate},
			#{updateBy.id},
			#{updateDate},
			#{remarks},
			#{delFlag}
		)
	</insert>
	
	<update id="update">
		UPDATE ycsl_slsq SET 	
			wwywh = #{wwywh},
			ywh = #{ywh},
			lcdm = #{lcdm},
			lcxlmc = #{lcxlmc},
			bdclb = #{bdclb},
			djjg = #{djjg},
			djjgmc = #{djjgmc},
			bsdt = #{bsdt},
			bsdtmc = #{bsdtmc},
			tjsj = #{tjsj},
			sqryhmc = #{sqryhmc},
			bdcqzh = #{bdcqzh},
			update_by = #{updateBy.id},
			update_date = #{updateDate},
			remarks = #{remarks}
		WHERE id = #{id}
	</update>
	
	<update id="delete">
		UPDATE ycsl_slsq SET 
			del_flag = #{DEL_FLAG_DELETE}
		WHERE id = #{id}
	</update>
	
</mapper>