RegBaseSllmDao.xml 6.62 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.RegBaseSllmDao">
	
	<sql id="regBaseSllmColumns">
		a.id AS "id",
		a.ysdm AS "ysdm",
		a.lmbm AS "lmbm",
		a.bdcdyh AS "bdcdyh",
		a.zddm AS "zddm",
		a.syqmj AS "syqmj",
		a.ldsyqxz AS "ldsyqxz",
		a.zysz AS "zysz",
		a.zs AS "zs",
		a.lz AS "lz",
		a.qy AS "qy",
		a.zlnd AS "zlnd",
		a.lb AS "lb",
		a.xb AS "xb",
		a.xdm AS "xdm",
		a.status AS "status",
		a.zdid AS "zdid",
		a.isdiya AS "isdiya",
		a.ischafeng AS "ischafeng",
		a.isyiyi AS "isyiyi",
		a.isaudit AS "isaudit",
		a.islogout AS "islogout",
		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.zl AS "zl",
		a.qlxz AS "qlxz",
		a.yt AS "yt",
		a.qllx AS "qllx"
	</sql>
	
	<sql id="regBaseSllmJoins">
	</sql>
	
	<select id="get" resultType="RegBaseSllm">
		SELECT 
			<include refid="regBaseSllmColumns"/>
		FROM reg_base_sllm a
		<include refid="regBaseSllmJoins"/>
		WHERE a.id = #{id}
	</select>
	
	<select id="getLmbmStr" resultType="string">
		select MAX(lmbm) from reg_base_sllm where del_flag = '0'
	</select>
	
	<select id="findList" resultType="RegBaseSllm">
		SELECT 
			<include refid="regBaseSllmColumns"/>
		FROM reg_base_sllm a
		<include refid="regBaseSllmJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
			<if test="bdcdyh != null and bdcdyh != ''">
				AND a.bdcdyh LIKE 
					<if test="dbName == 'oracle'">'%'||#{bdcdyh}||'%'</if>
					<if test="dbName == 'mssql'">'%'+#{bdcdyh}+'%'</if>
					<if test="dbName == 'mysql'">concat('%',#{bdcdyh},'%')</if>
			</if>
			<if test="zddm != null and zddm !=''">
				AND a.zddm = #{zddm}
			</if>
			<if test="zl != null and zl !=''">
				AND a.zl = #{zl}
			</if>
			<if test="isaudit != null and isaudit !=''">
				AND a.isaudit = #{isaudit}
			</if>
			<if test="isdiya != null and isdiya !=''">
				AND a.isdiya = #{isdiya}
			</if>
			<if test="ischafeng != null and ischafeng !=''">
				AND a.ischafeng = #{ischafeng}
			</if>
			<if test="isyiyi != null and isyiyi !=''">
				AND a.isyiyi = #{isyiyi}
			</if>
			<if test="islogout != null and islogout != ''">
				<if test="islogout == 13">
					AND (a.islogout = '0' or a.islogout = '3' or a.islogout >= 100)
				</if>
				<if test="islogout != 13">
					AND a.islogout = #{islogout}
				</if>
			</if>
		</where>
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
				ORDER BY a.create_date DESC
			</otherwise>
		</choose>
	</select>
	
	<select id="getMaxLmbdcdyhOfOracle" resultType="string">
		select MAX(substr(bdcdyh, -8)) from reg_base_sllm a
		<where>
			a.bdcdyh Like #{bdcdyh}||'%'
		</where>
	</select>
	
	<select id="findAllList" resultType="RegBaseSllm">
		SELECT 
			<include refid="regBaseSllmColumns"/>
		FROM reg_base_sllm a
		<include refid="regBaseSllmJoins"/>
		<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>
	
	<select id="getBdcdyh" resultType="RegBaseSllm">
		SELECT 
			<include refid="regBaseSllmColumns"/>
		FROM reg_base_sllm a
		<include refid="regBaseSllmJoins"/>
		WHERE a.del_flag = '0'
		AND a.bdcdyh = #{bdcdyh} 
		AND a.islogout = '0'
	</select>
	
	<update id="delete">
		DELETE FROM reg_base_sllm 
		WHERE id = #{id}
	</update>
	
	<insert id="insert">
		INSERT INTO reg_base_sllm(
			id,
			ysdm,
			lmbm,
			bdcdyh,
			zddm,
			syqmj,
			ldsyqxz,
			zysz,
			zs,
			lz,
			qy,
			zlnd,
			lb,
			xb,
			xdm,
			status,
			zdid,
			isdiya,
			ischafeng,
			isyiyi,
			isaudit,
			islogout,
			create_by,
			create_date,
			update_by,
			update_date,
			remarks,
			del_flag,
			zl,
			yt,
			qllx,
			qlxz
		) VALUES (
			#{id},
			#{ysdm},
			#{lmbm},
			#{bdcdyh},
			#{zddm},
			#{syqmj},
			#{ldsyqxz},
			#{zysz},
			#{zs},
			#{lz},
			#{qy},
			#{zlnd},
			#{lb},
			#{xb},
			#{xdm},
			#{status},
			#{zdid},
			#{isdiya},
			#{ischafeng},
			#{isyiyi},
			#{isaudit},
			#{islogout},
			#{createBy.id},
			#{createDate},
			#{updateBy.id},
			#{updateDate},
			#{remarks},
			#{delFlag},
			#{zl},
			#{yt},
			#{qllx},
			#{qlxz}
		)
	</insert>
	
	<update id="update">
		UPDATE reg_base_sllm SET
			id = #{id},
			ysdm = #{ysdm},
			lmbm = #{lmbm},
			bdcdyh = #{bdcdyh},
			zddm = #{zddm},
			syqmj = #{syqmj},
			ldsyqxz = #{ldsyqxz},
			zysz = #{zysz},
			zs = #{zs},
			lz = #{lz},
			qy = #{qy},
			zlnd = #{zlnd},
			lb = #{lb},
			xb = #{xb},
			xdm = #{xdm},
			status = #{status},
			zdid = #{zdid},
			isdiya = #{isdiya},
			ischafeng = #{ischafeng},
			isyiyi = #{isyiyi},
			isaudit = #{isaudit},
			islogout = #{islogout},
			update_by = #{updateBy.id},
			update_date = #{updateDate},
			remarks = #{remarks},
			zl = #{zl},
			qlxz = #{qlxz},
			yt = #{yt},
			qllx =#{qllx},
			del_flag = #{delFlag}
		WHERE id = #{id}
	</update>
	
	<select id="findListqj" resultType="RegBaseSllm">
		SELECT 
			<include refid="regBaseSllmColumns"/>
		FROM reg_base_sllm a
		<include refid="regBaseSllmJoins"/>
		<where>
			a.del_flag != '1' 
			<if test="bdcdyh != null and bdcdyh != ''">
				AND a.bdcdyh LIKE 
					<if test="dbName == 'oracle'">'%'||#{bdcdyh}||'%'</if>
					<if test="dbName == 'mssql'">'%'+#{bdcdyh}+'%'</if>
					<if test="dbName == 'mysql'">concat('%',#{bdcdyh},'%')</if>
			</if>
			<if test="zddm != null and zddm !=''">
				AND a.zddm = #{zddm}
			</if>
			<if test="zl != null and zl !=''">
				AND a.zl = #{zl}
			</if>
			<if test="isaudit != null and isaudit !=''">
				AND a.isaudit = #{isaudit}
			</if>
			<if test="isdiya != null and isdiya !=''">
				AND a.isdiya = #{isdiya}
			</if>
			<if test="ischafeng != null and ischafeng !=''">
				AND a.ischafeng = #{ischafeng}
			</if>
			<if test="isyiyi != null and isyiyi !=''">
				AND a.isyiyi = #{isyiyi}
			</if>
			<if test="islogout != null and islogout != ''">
				<if test="islogout == 13">
					AND (a.islogout = '0' or a.islogout = '3' or a.islogout >= 100)
				</if>
				<if test="islogout != 13">
					AND a.islogout = #{islogout}
				</if>
			</if>
		</where>
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
				ORDER BY a.create_date DESC
			</otherwise>
		</choose>
	</select>
	
	<update id="deleteqj">
		UPDATE reg_base_sllm SET 
			del_flag = '2'
		WHERE id = #{id}
	</update>
</mapper>