RegBasePersonDao.xml 7.54 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.RegBasePersonDao">
    
	<sql id="regBasePersonColumns">
		a.id AS "id",
		a.pcode AS "pcode",
		a.rymc AS "rymc",
		a.zjzl AS "zjzl",
		a.zjh AS "zjh",
		a.sshy AS "sshy",
		a.gj AS "gj",
		a.hjszss AS "hjszss",
		a.xb AS "xb",
		a.dh AS "dh",
		a.dz AS "dz",
		a.yb AS "yb",
		a.gzdw AS "gzdw",
		a.dzyj AS "dzyj",
		a.rylx AS "rylx",
		a.dlrymc AS "dlrymc",
		a.dlrydh AS "dlrydh",
		a.dljg AS "dljg",
		a.bz AS "bz",
		a.isaudit AS "isaudit",
		a.fzjg AS "fzjg",
		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.veritydatazt AS "veritydatazt",
		a.veritydatamsg AS "veritydatamsg",
		a.bfrq AS "bfrq",
		a.datazt AS "datazt",
		a.datazttext AS "datazttext",
		a.fzr AS "fzr",
		a.djgljg AS "djgljg",
		a.yxqxz AS "yxqxz",
		a.yxqxs AS "yxqxs",
		a.onemc AS "onemc",
		a.idimgpers AS "idimgpers",
		a.sczt AS "sczt",
		a.veritysczt AS "veritysczt"
	</sql>
	
	<sql id="regBasePersonJoins">
	</sql>
    
	<select id="get" resultType="RegBasePerson">
		SELECT 
			<include refid="regBasePersonColumns"/>
		FROM reg_base_person a
		<include refid="regBasePersonJoins"/>
		WHERE a.id = #{id}
	</select>
	
	<select id="getID" resultType="RegBasePerson">
		SELECT 
			<include refid="regBasePersonColumns"/>
		FROM reg_base_person a
		<include refid="regBasePersonJoins"/>
		WHERE a.zjh = #{zjh} AND del_flag = '0'
	</select>
	
	<select id="getHMaxPCode" resultType="String">
		select MAX(pcode) from reg_base_person where del_flag = '0'
	</select>
	<select id="getHMaxPCodeOfOracle" resultType="String">
		select MAX(to_number(pcode)) from reg_base_person where del_flag = '0'
	</select>
	
	<select id="findList" resultType="RegBasePerson">
		SELECT 
			<include refid="regBasePersonColumns"/>
		FROM reg_base_person a
		<include refid="regBasePersonJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
			<if test="rymc != null and rymc != ''">
				AND a.rymc LIKE 
				<if test="dbName == 'oracle'">'%'||#{rymc}||'%'</if>
				<if test="dbName == 'mssql'">'%'+#{rymc}+'%'</if>
				<if test="dbName == 'mysql'">concat('%',#{rymc},'%')</if>
			</if>
			<if test="zjh != null and zjh != ''">
				AND a.zjh LIKE 
					<if test="dbName == 'oracle'">'%'||#{zjh}||'%'</if>
					<if test="dbName == 'mssql'">'%'+#{zjh}+'%'</if>
					<if test="dbName == 'mysql'">concat('%',#{zjh},'%')</if>
			</if>
			<if test="zjzl != null and zjzl != ''">
				AND a.zjzl = #{zjzl}
			</if>
			<if test="pcode != null and pcode != ''">
				AND a.pcode = #{pcode}
			</if>
		</where>
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
				<if test="dljg == 1">
					ORDER BY a.pcode DESC
				</if>
				<if test="dljg == null or dljg == ''">
					ORDER BY a.update_date desc
				</if>
			</otherwise>
		</choose>
	</select>
	
	
	<select id="findListqy" resultType="RegBasePerson">
		SELECT 
			<include refid="regBasePersonColumns"/>
		FROM reg_base_person a
		<include refid="regBasePersonJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
			<if test="rymc != null and rymc != ''">
				AND a.rymc = #{rymc} 
			</if>
			<if test="zjh != null and zjh != ''">
				AND a.zjh = #{zjh} 
			</if>
			<if test="zjzl != null and zjzl != ''">
				AND a.zjzl = #{zjzl} 
			</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="findfwqlrgmList" resultType="RegBasePerson">
		SELECT 
			<include refid="regBasePersonColumns"/>
		FROM reg_base_person a
		<include refid="regBasePersonJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
			AND (a.pcode = #{pcode} or a.rymc = #{rymc} or (a.zjzl =  #{zjzl} and a.zjh = #{zjh}))
		</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="findIsexistList" resultType="RegBasePerson">
		SELECT 
			<include refid="regBasePersonColumns"/>
		FROM reg_base_person a
		<include refid="regBasePersonJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
			AND 
				((a.zjh = #{zjh} AND a.zjzl = #{zjzl})
				OR
				(a.rymc = #{rymc} AND a.zjh = #{zjh} AND a.zjzl = #{zjzl}))
		</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="RegBasePerson">
		SELECT 
			<include refid="regBasePersonColumns"/>
		FROM reg_base_person a
		<include refid="regBasePersonJoins"/>
		<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_person(
			id,
			pcode,
			rymc,
			zjzl,
			zjh,
			sshy,
			gj,
			hjszss,
			xb,
			dh,
			dz,
			yb,
			gzdw,
			dzyj,
			rylx,
			dlrymc,
			dlrydh,
			dljg,
			bz,
			isaudit,
			fzjg,
			create_by,
			create_date,
			update_by,
			update_date,
			remarks,
			del_flag,
			veritydatazt,
			veritydatamsg,
			bfrq,
			datazt,
			datazttext,
			fzr,
			djgljg,
			yxqxz,
			yxqxs,
			onemc, 
			idimgpers,
			sczt,
			veritysczt
		) VALUES (
			#{id},
			#{pcode},
			#{rymc},
			#{zjzl},
			#{zjh},
			#{sshy},
			#{gj},
			#{hjszss},
			#{xb},
			#{dh},
			#{dz},
			#{yb},
			#{gzdw},
			#{dzyj},
			#{rylx},
			#{dlrymc},
			#{dlrydh},
			#{dljg},
			#{bz},
			#{isaudit},
			#{fzjg},
			#{createBy.id},
			#{createDate},
			#{updateBy.id},
			#{updateDate},
			#{remarks},
			#{delFlag},
			#{veritydatazt},
			#{veritydatamsg},
			#{bfrq},
			#{datazt},
			#{datazttext},
			#{fzr},
			#{djgljg},
			#{yxqxz},
			#{yxqxs},
			#{onemc},
			#{idimgpers},
			#{sczt},
			#{veritysczt}
		)
	</insert>
	
	<update id="update">
		UPDATE reg_base_person SET 	
			pcode = #{pcode},
			rymc = #{rymc},
			zjzl = #{zjzl},
			zjh = #{zjh},
			sshy = #{sshy},
			gj = #{gj},
			hjszss = #{hjszss},
			xb = #{xb},
			dh = #{dh},
			dz = #{dz},
			yb = #{yb},
			gzdw = #{gzdw},
			dzyj = #{dzyj},
			rylx = #{rylx},
			dlrymc = #{dlrymc},
			dlrydh = #{dlrydh},
			dljg = #{dljg},
			bz = #{bz},
			isaudit = #{isaudit},
			fzjg = #{fzjg},
			update_by = #{updateBy.id},
			update_date = #{updateDate},
			remarks = #{remarks},
			veritydatazt=#{veritydatazt},
			veritydatamsg=#{veritydatamsg},
			bfrq=#{bfrq},
			datazt=#{datazt},
			datazttext=#{datazttext},
			fzr=#{fzr},
			djgljg=#{djgljg},
			yxqxz=#{yxqxz},
			yxqxs=#{yxqxs},
			onemc=#{onemc},
			idimgpers = #{idimgpers},
			sczt = #{sczt},
			veritysczt = #{veritysczt}
		WHERE id = #{id}
	</update>
	
	<update id="delete">
		UPDATE reg_base_person SET 
			del_flag = #{DEL_FLAG_DELETE}
		WHERE id = #{id}
	</update>
	
	<update id="deletery">
		DELETE FROM reg_base_person WHERE id = #{id}
	</update>
	
	<select id="getByZwr" resultType="RegBasePerson">
		SELECT 
			<include refid="regBasePersonColumns"/>
		FROM reg_base_person a
		<include refid="regBasePersonJoins"/>
		WHERE a.zjh = #{0} and a.rymc = #{1} AND del_flag = '0'
	</select>
	
</mapper>