84711fe60bfd61968477f8e4838f9b465c3932cc.svn-base 3.21 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.sumdata.dao.datatable.SRegBaseXmDao">
    
	<sql id="sRegBaseXmColumns">
		a.id AS "id",
		a.s_area_code AS "sareaCode",
		a.xmbh AS "xmbh",
		a.xmmc AS "xmmc",
		a.sqsj AS "sqsj",
		a.zddm AS "zddm",
		a.jsdwmc AS "jsdwmc",
		a.zjzl AS "zjzl",
		a.zjh AS "zjh",
		a.dwdz AS "dwdz",
		a.sm AS "sm",
		a.isaudit AS "isaudit",
		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",
		a.qxid AS "qxid"
	</sql>
	
	<sql id="sRegBaseXmJoins">
	</sql>
    
	<select id="get" resultType="SRegBaseXm">
		SELECT 
			<include refid="sRegBaseXmColumns"/>
		FROM s_reg_base_xm a
		<include refid="sRegBaseXmJoins"/>
		WHERE a.id = #{id}
	</select>
	
	<select id="getqxid" resultType="SRegBaseXm">
		SELECT 
			<include refid="sRegBaseXmColumns"/>
		FROM s_reg_base_xm a
		<include refid="sRegBaseXmJoins"/>
		WHERE a.qxid = #{qxid}
	</select>
	
	<select id="findList" resultType="SRegBaseXm">
		SELECT 
			<include refid="sRegBaseXmColumns"/>
		FROM s_reg_base_xm a
		<include refid="sRegBaseXmJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
			<if test="sareaCode != null and sareaCode != ''">
				AND a.s_area_code = #{sareaCode}
			</if>
			<if test="qxid != null and qxid != ''">
				AND a.qxid = #{qxid}
			</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="SRegBaseXm">
		SELECT 
			<include refid="sRegBaseXmColumns"/>
		FROM s_reg_base_xm a
		<include refid="sRegBaseXmJoins"/>
		<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 s_reg_base_xm(
			id,
			s_area_code,
			xmbh,
			xmmc,
			sqsj,
			zddm,
			jsdwmc,
			zjzl,
			zjh,
			dwdz,
			sm,
			isaudit,
			create_by,
			create_date,
			update_by,
			update_date,
			remarks,
			del_flag,
			qxid
		) VALUES (
			#{id},
			#{sareaCode},
			#{xmbh},
			#{xmmc},
			#{sqsj},
			#{zddm},
			#{jsdwmc},
			#{zjzl},
			#{zjh},
			#{dwdz},
			#{sm},
			#{isaudit},
			#{createBy.id},
			#{createDate},
			#{updateBy.id},
			#{updateDate},
			#{remarks},
			#{delFlag},
			#{qxid}
		)
	</insert>
	
	<update id="update">
		UPDATE s_reg_base_xm SET 	
			s_area_code = #{sareaCode},
			xmbh = #{xmbh},
			xmmc = #{xmmc},
			sqsj = #{sqsj},
			zddm = #{zddm},
			jsdwmc = #{jsdwmc},
			zjzl = #{zjzl},
			zjh = #{zjh},
			dwdz = #{dwdz},
			sm = #{sm},
			isaudit = #{isaudit},
			update_by = #{updateBy.id},
			update_date = #{updateDate},
			remarks = #{remarks},
			qxid = #{qxid}
		WHERE id = #{id}
	</update>
	
	<update id="delete">
		UPDATE s_reg_base_xm SET 
			del_flag = #{DEL_FLAG_DELETE}
		WHERE id = #{id}
	</update>
	
</mapper>