Kc01Dao.xml 4.44 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.Kc01Dao">
    
	<sql id="kc01Columns">
		a.id AS "id",
		a.akc002 AS "akc002",
		a.akc003 AS "akc003",
		a.akc004 AS "akc004",
		a.akc005 AS "akc005",
		a.akc006 AS "akc006",
		a.akc007 AS "akc007",
		a.akc008 AS "akc008",
		a.akc009 AS "akc009",
		a.akc010 AS "akc010",
		a.akc011 AS "akc011",
		a.akc013 AS "akc013",
		a.akc012 AS "akc012",
		a.akc014 AS "akc014",
		a.akc015 AS "akc015",
		a.akc016 AS "akc016",
		a.akc017 AS "akc017",
		a.akc018 AS "akc018"
	</sql>
	
	<sql id="kc01Joins">
	</sql>
    
	<select id="get" resultType="Kc01">
		SELECT 
			<include refid="kc01Columns"/>
		FROM kc01 a
		<include refid="kc01Joins"/>
		WHERE a.id = #{id}
	</select>
	
	<select id="findList" resultType="Kc01">
		SELECT 
			<include refid="kc01Columns"/>
		FROM kc01 a
		<include refid="kc01Joins"/>
		<where>
			<if test="akc002 != null and akc002 != ''">
					AND a.akc002 LIKE 
						<if test="dbName == 'oracle'">'%'||#{akc002}||'%'</if>
						<if test="dbName == 'mssql'">'%'+#{akc002}+'%'</if>
						<if test="dbName == 'mysql'">concat('%',#{akc002},'%')</if>
			</if>
			<if test="akc003 != null and akc003 != ''">
					AND a.akc003 = #{akc003}
			</if>
			<if test="akc004 != null and akc004 != ''">
					AND a.akc004 LIKE 
						<if test="dbName == 'oracle'">'%'||#{akc004}||'%'</if>
						<if test="dbName == 'mssql'">'%'+#{akc004}+'%'</if>
						<if test="dbName == 'mysql'">concat('%',#{akc004},'%')</if>
			</if>
			<if test="akc005 != null and akc005 != ''">
					AND a.akc004 LIKE 
						<if test="dbName == 'oracle'">'%'||#{akc005}||'%'</if>
						<if test="dbName == 'mssql'">'%'+#{akc005}+'%'</if>
						<if test="dbName == 'mysql'">concat('%',#{akc005},'%')</if>
			</if>
			<if test="akc006 != null and akc006 != ''">
					AND a.akc006 = #{akc006}
			</if>	
			<if test="akc008 != null and akc008 != ''">
				<if test="akc008 == '13'">
					AND (a.akc008 = '1' or a.akc008 = '3')
				</if>
				<if test="akc008 != '13'">
					AND a.akc008 = #{akc008}
				</if>
			</if>	
			<if test="akc007 != null and akc007 != ''">
					AND a.akc007 = #{akc007}
			</if>	
			<if test="akc009 != null and akc009 != ''">
					AND a.akc009 = #{akc009}
			</if>	
			<if test="akc015 != null and akc015 != ''">
					AND a.akc015 = #{akc015}
			</if>
			<if test="akc016 != null and akc016 != ''">
					AND a.akc016 = #{akc016}
			</if>
			<if test="akc017 != null and akc017 != ''">
					AND a.akc017 = #{akc017}
			</if>
			<if test="akc018 != null and akc018 != ''">
					AND a.akc018 = #{akc018}
			</if>
			<if test="id != null and id != ''">
					AND a.id = #{id}
			</if>	
		</where>
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
				ORDER BY a.akc011 desc
			</otherwise>
		</choose>
	</select>
	
	<select id="getyhsxh" resultType="string">
		select MAX(akc012) a from kc01 where akc012 is not null and akc014 = #{akc014}
	</select>
	
	<select id="findAllList" resultType="Kc01">
		SELECT 
			<include refid="kc01Columns"/>
		FROM kc01 a
		<include refid="kc01Joins"/>
		<where>
			
		</where>		
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
			</otherwise>
		</choose>
	</select>
	
	<insert id="insert">
		INSERT INTO kc01(
			id,
			akc002,
			akc003,
			akc004,
			akc005,
			akc006,
			akc007,
			akc008,
			akc009,
			akc010,
			akc011,
			akc013,
			akc012,
			akc014,
			akc015,
			akc016,
			akc017,
			akc018
		) VALUES (
			#{id},
			#{akc002},
			#{akc003},
			#{akc004},
			#{akc005},
			#{akc006},
			#{akc007},
			#{akc008},
			#{akc009},
			#{akc010},
			#{akc011},
			#{akc013},
			#{akc012},
			#{akc014},
			#{akc015},
			#{akc016},
			#{akc017},
			#{akc018}
		)
	</insert>
	
	<update id="update">
		UPDATE kc01 SET 	
			akc002 = #{akc002},
			akc003 = #{akc003},
			akc004 = #{akc004},
			akc005 = #{akc005},
			akc006 = #{akc006},
			akc007 = #{akc007},
			akc008 = #{akc008},
			akc009 = #{akc009},
			akc010 = #{akc010},
			akc011 = #{akc011},
			akc013 = #{akc013},
			akc012 = #{akc012},
			akc014 = #{akc014},
			akc015 = #{akc015},
			akc016 = #{akc016},
			akc017 = #{akc017},
			akc018 = #{akc018}
		WHERE id = #{id}
	</update>
	
	<update id="delete">
		DELETE FROM kc01
		WHERE id = #{id}
	</update>
	
</mapper>