RegBaseYyDao.xml 3.22 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.base.RegBaseYyDao">
    
	<sql id="regBaseYyColumns">
		a.id AS "id",
		a.yyh AS "yyh",
		a.djdl AS "djdl",
		a.yyrmc AS "yyrmc",
		a.yyrzjzl AS "yyrzjzl",
		a.yyrzjh AS "yyrzjh",
		a.yyrphone AS "yyrphone",
		a.dates AS "dates",
		a.times AS "times",
		a.yyfs AS "yyfs",
		a.str1 AS "str1",
		a.str2 AS "str2",
		a.str3 AS "str3",
		a.str4 AS "str4",
		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="regBaseYyJoins">
	</sql>
    
	<select id="get" resultType="RegBaseYy">
		SELECT 
			<include refid="regBaseYyColumns"/>
		FROM reg_base_yy a
		<include refid="regBaseYyJoins"/>
		WHERE a.id = #{id}
	</select>
	
	<select id="findList" resultType="RegBaseYy">
		SELECT 
			<include refid="regBaseYyColumns"/>
		FROM reg_base_yy a
		<include refid="regBaseYyJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
			<if test="yyrmc != null and yyrmc != ''">
				AND a.yyrmc = #{yyrmc}
			</if>
			<if test="yyrzjzl != null and yyrzjzl != ''">
				AND a.yyrzjzl = #{yyrzjzl}
			</if>
			<if test="yyrzjh != null and yyrzjh != ''">
				AND a.yyrzjh = #{yyrzjh}
			</if>
			<if test="dates != null and dates != ''">
				AND a.dates = #{dates}
			</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="RegBaseYy">
		SELECT 
			<include refid="regBaseYyColumns"/>
		FROM reg_base_yy a
		<include refid="regBaseYyJoins"/>
		<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 reg_base_yy(
			id,
			yyh,
			djdl,
			yyrmc,
			yyrzjzl,
			yyrzjh,
			yyrphone,
			dates,
			times,
			yyfs,
			str1,
			str2,
			str3,
			str4,
			create_by,
			create_date,
			update_by,
			update_date,
			remarks,
			del_flag
		) VALUES (
			#{id},
			#{yyh},
			#{djdl},
			#{yyrmc},
			#{yyrzjzl},
			#{yyrzjh},
			#{yyrphone},
			#{dates},
			#{times},
			#{yyfs},
			#{str1},
			#{str2},
			#{str3},
			#{str4},
			#{createBy.id},
			#{createDate},
			#{updateBy.id},
			#{updateDate},
			#{remarks},
			#{delFlag}
		)
	</insert>
	
	<update id="update">
		UPDATE reg_base_yy SET 	
			yyh = #{yyh},
			djdl = #{djdl},
			yyrmc = #{yyrmc},
			yyrzjzl = #{yyrzjzl},
			yyrzjh = #{yyrzjh},
			yyrphone = #{yyrphone},
			dates = #{dates},
			times = #{times},
			yyfs = #{yyfs},
			str1 = #{str1},
			str2 = #{str2},
			str3 = #{str3},
			str4 = #{str4},
			update_by = #{updateBy.id},
			update_date = #{updateDate},
			remarks = #{remarks}
		WHERE id = #{id}
	</update>
	
	<update id="delete">
		UPDATE reg_base_yy SET 
			del_flag = #{DEL_FLAG_DELETE}
		WHERE id = #{id}
	</update>
	
</mapper>