| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- <?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="cn.com.goldenwater.dcproj.dao.TacPblmRectDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.TacPblmRect" id="tacPblmRectResultMap">
- <result property="id" column="ID"/>
- <result property="year" column="YEAR"/>
- <result property="batch" column="BATCH"/>
- <result property="title" column="TITLE"/>
- <result property="nub" column="NUB"/>
- <result property="explain" column="EXPLAIN"/>
- <result property="printTm" column="PRINT_TM"/>
- <result property="closeTm" column="CLOSE_TM"/>
- <result property="sndOrgSize" column="SND_ORG_SIZE"/>
- <result property="prjctSize" column="PRJCT_SIZE"/>
- <result property="pblmSize" column="PBLM_SIZE"/>
- <result property="persId" column="PERS_ID"/>
- <result property="persName" column="PERS_NAME"/>
- <result property="intm" column="INTM"/>
- <result property="uptm" column="UPTM"/>
- <result property="dataStat" column="DATA_STAT"/>
- <result property="fileId" column="FILE_ID"/>
- <result property="fileName" column="FILE_NAME"/>
- <result property="filePath" column="FILE_PATH"/>
- <result property="sendAll" column="SEND_ALL"/>
- </resultMap>
- <sql id="table_columns">
- ID,
- `YEAR`,
- BATCH,
- TITLE,
- NUB,
- `EXPLAIN`,
- PRINT_TM,
- CLOSE_TM,
- SND_ORG_SIZE,
- PRJCT_SIZE,
- PBLM_SIZE,
- PERS_ID,
- PERS_NAME,
- INTM,
- UPTM,
- DATA_STAT
- </sql>
- <sql id="entity_properties">
- #{id},
- #{year},
- #{batch},
- #{title},
- #{nub},
- #{explain},
- #{printTm},
- #{closeTm},
- #{sndOrgSize},
- #{prjctSize},
- #{pblmSize},
- #{persId},
- #{persName},
- #{intm},
- #{uptm},
- #{dataStat}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="year != null and year != ''">and `YEAR` = #{year}</if>
- <if test="batch != null and batch != ''">and BATCH = #{batch}</if>
- <if test="title != null and title != ''">and TITLE = #{title}</if>
- <if test="nub != null and nub != ''">and NUB = #{nub}</if>
- <if test="explain != null and explain != ''">and `EXPLAIN` = #{explain}</if>
- <if test="printTm != null">and PRINT_TM = #{printTm}</if>
- <if test="closeTm != null">and CLOSE_TM = #{closeTm}</if>
- <if test="sndOrgSize != null and sndOrgSize != ''">and SND_ORG_SIZE = #{sndOrgSize}</if>
- <if test="prjctSize != null and prjctSize != ''">and PRJCT_SIZE = #{prjctSize}</if>
- <if test="pblmSize != null and pblmSize != ''">and PBLM_SIZE = #{pblmSize}</if>
- <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
- <if test="persName != null and persName != ''">and PERS_NAME = #{persName}</if>
- <if test="intm != null">and INTM = #{intm}</if>
- <if test="uptm != null">and UPTM = #{uptm}</if>
- <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
- and DATA_STAT='0'
- </trim>
- </sql>
- <select id="get" resultMap="tacPblmRectResultMap" parameterType="String">
- select A.*,B.FILE_NAME,B.ID FILE_ID,B.FILE_PATH,
- (case when (select count(*) from TAC_PBLM_RECT_ORG d where d.rect_id=a.id)=0 then '0' when (select count(*) from TAC_PBLM_RECT_ORG c where c.state in ('1','2') and c.rect_id=a.id)=(select count(*) from TAC_PBLM_RECT_ORG d where d.rect_id=a.id) then '1' else '0' end)SEND_ALL
- from tac_pblm_rect A LEFT JOIN GW_COM_FILE B ON A.ID=B.BIZ_ID where A.ID = #{id}
- </select>
- <select id="getBy" resultMap="tacPblmRectResultMap">
- select A.*,B.FILE_NAME,B.ID FILE_ID,B.FILE_PATH,
- (case when (select count(*) from TAC_PBLM_RECT_ORG d where d.rect_id=a.id)=0 then '0' when (select count(*) from TAC_PBLM_RECT_ORG c where c.state in ('1','2') and c.rect_id=a.id)=(select count(*) from TAC_PBLM_RECT_ORG d where d.rect_id=a.id) then '1' else '0' end)SEND_ALL
- from tac_pblm_rect A LEFT JOIN GW_COM_FILE B ON A.ID=B.BIZ_ID
- <include refid="page_where"/>
- </select>
- <select id="findAll" resultMap="tacPblmRectResultMap">
- select
- <include refid="table_columns"/>
- from TAC_PBLM_RECT
- </select>
- <select id="findList" resultMap="tacPblmRectResultMap">
- select A.*,B.FILE_NAME,B.ID FILE_ID,B.FILE_PATH,
- (case when (select count(*) from TAC_PBLM_RECT_ORG d where d.rect_id=a.id)=0 then '0' when (select count(*) from TAC_PBLM_RECT_ORG c where c.state in ('1','2') and c.rect_id=a.id)=(select count(*) from TAC_PBLM_RECT_ORG d where d.rect_id=a.id) then '1' else '0' end)SEND_ALL
- from tac_pblm_rect A LEFT JOIN GW_COM_FILE B ON A.ID=B.BIZ_ID
- <include refid="page_where"/>
- ORDER BY YEAR,BATCH
- </select>
- <select id="selectCount" resultType="int">
- select count(ID) from TAC_PBLM_RECT
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacPblmRect">
- insert into TAC_PBLM_RECT(
- <include refid="table_columns"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- update TAC_PBLM_RECT set DATA_STAT='9' where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacPblmRect">
- update TAC_PBLM_RECT set DATA_STAT='9'
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update TAC_PBLM_RECT set DATA_STAT='9' set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacPblmRect">
- update TAC_PBLM_RECT
- <trim prefix="set" suffixOverrides=",">
- <if test="year != null and year != ''">YEAR = #{year},</if>
- <if test="batch != null and batch != ''">BATCH = #{batch},</if>
- <if test="title != null and title != ''">TITLE = #{title},</if>
- <if test="nub != null and nub != ''">NUB = #{nub},</if>
- <if test="explain != null and explain != ''">`EXPLAIN` = #{explain},</if>
- <if test="printTm != null">PRINT_TM = #{printTm},</if>
- <if test="closeTm != null">CLOSE_TM = #{closeTm},</if>
- <if test="sndOrgSize != null and sndOrgSize != ''">SND_ORG_SIZE = #{sndOrgSize},</if>
- <if test="prjctSize != null and prjctSize != ''">PRJCT_SIZE = #{prjctSize},</if>
- <if test="pblmSize != null and pblmSize != ''">PBLM_SIZE = #{pblmSize},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="persName != null and persName != ''">PERS_NAME = #{persName},</if>
- <if test="intm != null">INTM = #{intm},</if>
- <if test="uptm != null">UPTM = #{uptm},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacPblmRect">
- update TAC_PBLM_RECT
- <trim prefix="set" suffixOverrides=",">
- <if test="year != null and year != ''">YEAR = #{year},</if>
- <if test="batch != null and batch != ''">BATCH = #{batch},</if>
- <if test="title != null and title != ''">TITLE = #{title},</if>
- <if test="nub != null and nub != ''">NUB = #{nub},</if>
- <if test="explain != null and explain != ''">`EXPLAIN` = #{explain},</if>
- <if test="printTm != null">PRINT_TM = #{printTm},</if>
- <if test="closeTm != null">CLOSE_TM = #{closeTm},</if>
- <if test="sndOrgSize != null and sndOrgSize != ''">SND_ORG_SIZE = #{sndOrgSize},</if>
- <if test="prjctSize != null and prjctSize != ''">PRJCT_SIZE = #{prjctSize},</if>
- <if test="pblmSize != null and pblmSize != ''">PBLM_SIZE = #{pblmSize},</if>
- <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
- <if test="persName != null and persName != ''">PERS_NAME = #{persName},</if>
- <if test="intm != null">INTM = #{intm},</if>
- <if test="uptm != null">UPTM = #{uptm},</if>
- <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
- </trim>
- <include refid="page_where"/>
- </update>
- <!-- 其他自定义SQL -->
- <select id="getYear" resultType="cn.com.goldenwater.dcproj.model.TacInspYear">
- SELECT DISTINCT YEAR,YEAR ID FROM TAC_INSP_YEAR_BATCH WHERE ID IN ( SELECT A.year_batch_id FROM
- TAC_INSP_YEAR_BATCH_GROUP_PERS A JOIN
- TAC_INSP_YEAR_BATCH_AREA B ON A.GROUP_ID=B.GROUP_ID WHERE 1=1
- <if test="persId != null and persId != ''">
- and A.PERS_ID=#{persId}
- </if>
- ) ORDER BY YEAR
- </select>
- <select id="getBatchByYearPersId" resultType="cn.com.goldenwater.dcproj.model.TacInspBatch">
- SELECT
- batch,
- max(id) id
- FROM
- TAC_INSP_YEAR_BATCH
- WHERE
- year = #{year}
- AND PROVINCE IS NOT NULL
- group by BATCH
- ORDER BY BATCH
- </select>
- </mapper>
|