| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393 |
- <?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.AttCwsBaseDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.AttCwsBase" id="attCwsBaseResultMap">
- <result property="edtrPesr" column="EDTR_PESR"/>
- <result property="uptm" column="UPTM"/>
- <result property="centerXGd" column="CENTER_X_GD"/>
- <result property="centerYGd" column="CENTER_Y_GD"/>
- <result property="addvcd" column="ADDVCD"/>
- <result property="guid" column="GUID"/>
- <result property="cwsCode" column="CWS_CODE"/>
- <result property="cwsName" column="CWS_NAME"/>
- <result property="cwsLong" column="CWS_LONG"/>
- <result property="cwsLat" column="CWS_LAT"/>
- <result property="cwsLoc" column="CWS_LOC"/>
- <result property="engType" column="ENG_TYPE"/>
- <result property="wasuType" column="WASU_TYPE"/>
- <result property="wasuRang" column="WASU_RANG"/>
- <result property="desWasuScal" column="DES_WASU_SCAL"/>
- <result property="desWasuPop" column="DES_WASU_POP"/>
- <result property="engStat" column="ENG_STAT"/>
- <result property="startDate" column="START_DATE"/>
- <result property="compDate" column="COMP_DATE"/>
- <result property="note" column="NOTE"/>
- <result property="effDate" column="EFF_DATE"/>
- <result property="exprDate" column="EXPR_DATE"/>
- <result property="compYear" column="COMP_YEAR"/>
- </resultMap>
- <sql id="table_columns">
- EDTR_PESR ,
- DATE_FORMAT(UPTM,'%Y-%m-%d %H:%i:%s') UPTM,
- CENTER_X_GD ,
- CENTER_Y_GD ,
- ADDVCD ,
- GUID ,
- CWS_CODE ,
- CWS_NAME ,
- CWS_LONG ,
- CWS_LAT ,
- CWS_LOC ,
- ENG_TYPE ,
- WASU_TYPE ,
- WASU_RANG ,
- DES_WASU_SCAL ,
- DES_WASU_POP ,
- ENG_STAT ,
- START_DATE ,
- DATE_FORMAT(COMP_DATE,'%Y-%m-%d') COMP_DATE,
- DATE_FORMAT(COMP_DATE,'%Y') COMP_YEAR,
- NOTE ,
- DATE_FORMAT(EFF_DATE,'%Y-%m-%d %H:%i:%s') EFF_DATE,
- DATE_FORMAT(EXPR_DATE,'%Y-%m-%d %H:%i:%s') EXPR_DATE
- </sql>
- <sql id="table_columns2">
- EDTR_PESR ,
- UPTM ,
- CENTER_X_GD ,
- CENTER_Y_GD ,
- ADDVCD ,
- GUID ,
- CWS_CODE ,
- CWS_NAME ,
- CWS_LONG ,
- CWS_LAT ,
- CWS_LOC ,
- ENG_TYPE ,
- WASU_TYPE ,
- WASU_RANG ,
- DES_WASU_SCAL ,
- DES_WASU_POP ,
- ENG_STAT ,
- START_DATE ,
- COMP_DATE ,
- NOTE ,
- EFF_DATE ,
- EXPR_DATE
- </sql>
- <sql id="entity_properties">
- #{edtrPesr},
- STR_TO_DATE(#{uptm},'%Y-%m-%d %H:%i:%s') ,
- #{centerXGd},
- #{centerYGd},
- #{addvcd},
- #{guid},
- #{cwsCode},
- #{cwsName},
- #{cwsLong},
- #{cwsLat},
- #{cwsLoc},
- #{engType},
- #{wasuType},
- #{wasuRang},
- #{desWasuScal},
- #{desWasuPop},
- #{engStat},
- #{startDate},
- STR_TO_DATE(#{compDate},'%Y-%m-%d'),
- #{note},
- STR_TO_DATE(#{effDate},'%Y-%m-%d %H:%i:%s') ,
- STR_TO_DATE(#{exprDate},'%Y-%m-%d %H:%i:%s')
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="edtrPesr != null and edtrPesr != ''">and EDTR_PESR = #{edtrPesr}</if>
- <if test="uptm != null and uptm != ''">and UPTM = STR_TO_DATE(#{uptm},'%Y-%m-%d %H:%i:%s')</if>
- <if test="centerXGd != null and centerXGd != ''">and CENTER_X_GD = #{centerXGd}</if>
- <if test="centerYGd != null and centerYGd != ''">and CENTER_Y_GD = #{centerYGd}</if>
- <if test="addvcd != null and addvcd != ''">and ADDVCD LIKE CONCAT(#{addvcd}, '%') </if>
- <if test="guid != null and guid != ''">and GUID = #{guid}</if>
- <if test="cwsCode != null and cwsCode != ''">and CWS_CODE = #{cwsCode}</if>
- <if test="cwsName != null and cwsName != ''">and CWS_NAME LIKE CONCAT('%', #{cwsName}, '%') </if>
- <if test="cwsLong != null and cwsLong != ''">and CWS_LONG = #{cwsLong}</if>
- <if test="cwsLat != null and cwsLat != ''">and CWS_LAT = #{cwsLat}</if>
- <if test="cwsLoc != null and cwsLoc != ''">and CWS_LOC = #{cwsLoc}</if>
- <if test="engType != null and engType != ''">and ENG_TYPE = #{engType}</if>
- <if test="wasuType != null and wasuType != ''">and WASU_TYPE = #{wasuType}</if>
- <if test="wasuRang != null and wasuRang != ''">and WASU_RANG = #{wasuRang}</if>
- <if test="desWasuScal != null and desWasuScal != ''">and DES_WASU_SCAL = #{desWasuScal}</if>
- <if test="desWasuPop != null and desWasuPop != ''">and DES_WASU_POP = #{desWasuPop}</if>
- <if test="engStat != null and engStat != ''">and ENG_STAT = #{engStat}</if>
- <if test="startDate != null and startDate != ''">and START_DATE = #{startDate}</if>
- <if test="compDate != null and compDate != ''">and COMP_DATE = STR_TO_DATE(#{compDate},'%Y-%m-%d')</if>
- <if test="note != null and note != ''">and NOTE = #{note}</if>
- <if test="effDate != null and effDate != ''">and EFF_DATE = STR_TO_DATE(#{effDate},'%Y-%m-%d %H:%i:%s')</if>
- <if test="exprDate != null and exprDate != ''">and EXPR_DATE = STR_TO_DATE(#{exprDate},'%Y-%m-%d %H:%i:%s')
- </if>
- AND EXPR_DATE IS NULL
- </trim>
- </sql>
- <select id="get" resultMap="attCwsBaseResultMap" parameterType="String">
- select
- <include refid="table_columns"/>
- from att_cws_base where CWS_CODE = #{id} AND EXPR_DATE IS NULL
- </select>
- <select id="getBy" resultMap="attCwsBaseResultMap">
- select
- <include refid="table_columns"/>
- from att_cws_base
- <include refid="page_where"/>
- </select>
- <select id="findAll" resultMap="attCwsBaseResultMap">
- select
- <include refid="table_columns"/>
- from att_cws_base
- </select>
- <select id="findList" resultMap="attCwsBaseResultMap">
- select
- <include refid="table_columns"/>
- from att_cws_base
- <include refid="page_where"/>
- ORDER BY EFF_DATE desc
- </select>
- <select id="selectCount" resultType="int">
- select count(GUID) from att_cws_base
- <include refid="page_where"/>
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttCwsBase">
- insert into att_cws_base(
- <include refid="table_columns2"/>
- )
- values (
- <include refid="entity_properties"/>
- )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- delete from att_cws_base where GUID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttCwsBase">
- delete from att_cws_base
- <include refid="page_where"/>
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update att_cws_base set flag_valid = 0 where GUID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttCwsBase">
- update att_cws_base
- <trim prefix="set" suffixOverrides=",">
- <if test="edtrPesr != null and edtrPesr != ''">EDTR_PESR = #{edtrPesr},</if>
- <if test="uptm != null and uptm != ''">UPTM = STR_TO_DATE(#{uptm},'%Y-%m-%d %H:%i:%s'),</if>
- <if test="centerXGd != null and centerXGd != ''">CENTER_X_GD = #{centerXGd},</if>
- <if test="centerYGd != null and centerYGd != ''">CENTER_Y_GD = #{centerYGd},</if>
- <if test="addvcd != null and addvcd != ''">ADDVCD = #{addvcd},</if>
- <if test="guid != null and guid != ''">GUID = #{guid},</if>
- <if test="cwsCode != null and cwsCode != ''">CWS_CODE = #{cwsCode},</if>
- <if test="cwsName != null and cwsName != ''">CWS_NAME = #{cwsName},</if>
- <if test="cwsLong != null and cwsLong != ''">CWS_LONG = #{cwsLong},</if>
- <if test="cwsLat != null and cwsLat != ''">CWS_LAT = #{cwsLat},</if>
- <if test="cwsLoc != null and cwsLoc != ''">CWS_LOC = #{cwsLoc},</if>
- <if test="engType != null and engType != ''">ENG_TYPE = #{engType},</if>
- <if test="wasuType != null and wasuType != ''">WASU_TYPE = #{wasuType},</if>
- <if test="wasuRang != null and wasuRang != ''">WASU_RANG = #{wasuRang},</if>
- <if test="desWasuScal != null and desWasuScal != ''">DES_WASU_SCAL = #{desWasuScal},</if>
- <if test="desWasuPop != null and desWasuPop != ''">DES_WASU_POP = #{desWasuPop},</if>
- <if test="engStat != null and engStat != ''">ENG_STAT = #{engStat},</if>
- <if test="startDate != null and startDate != ''">START_DATE = #{startDate},</if>
- <if test="compDate != null and compDate != ''">COMP_DATE = STR_TO_DATE(#{compDate},'%Y-%m-%d'),</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="effDate != null and effDate != ''">EFF_DATE = STR_TO_DATE(#{effDate},'%Y-%m-%d %H:%i:%s'),</if>
- <if test="exprDate != null and exprDate != ''">EXPR_DATE = STR_TO_DATE(#{exprDate},'%Y-%m-%d %H:%i:%s'),
- </if>
- </trim>
- <where>GUID = #{guid}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttCwsBase">
- update att_cws_base
- <trim prefix="set" suffixOverrides=",">
- <if test="edtrPesr != null and edtrPesr != ''">EDTR_PESR = #{edtrPesr},</if>
- <if test="uptm != null and uptm != ''">UPTM = STR_TO_DATE(#{uptm},'%Y-%m-%d %H:%i:%s'),</if>
- <if test="centerXGd != null and centerXGd != ''">CENTER_X_GD = #{centerXGd},</if>
- <if test="centerYGd != null and centerYGd != ''">CENTER_Y_GD = #{centerYGd},</if>
- <if test="addvcd != null and addvcd != ''">ADDVCD = #{addvcd},</if>
- <if test="guid != null and guid != ''">GUID = #{guid},</if>
- <if test="cwsCode != null and cwsCode != ''">CWS_CODE = #{cwsCode},</if>
- <if test="cwsName != null and cwsName != ''">CWS_NAME = #{cwsName},</if>
- <if test="cwsLong != null and cwsLong != ''">CWS_LONG = #{cwsLong},</if>
- <if test="cwsLat != null and cwsLat != ''">CWS_LAT = #{cwsLat},</if>
- <if test="cwsLoc != null and cwsLoc != ''">CWS_LOC = #{cwsLoc},</if>
- <if test="engType != null and engType != ''">ENG_TYPE = #{engType},</if>
- <if test="wasuType != null and wasuType != ''">WASU_TYPE = #{wasuType},</if>
- <if test="wasuRang != null and wasuRang != ''">WASU_RANG = #{wasuRang},</if>
- <if test="desWasuScal != null and desWasuScal != ''">DES_WASU_SCAL = #{desWasuScal},</if>
- <if test="desWasuPop != null and desWasuPop != ''">DES_WASU_POP = #{desWasuPop},</if>
- <if test="engStat != null and engStat != ''">ENG_STAT = #{engStat},</if>
- <if test="startDate != null and startDate != ''">START_DATE = #{startDate},</if>
- <if test="compDate != null and compDate != ''">COMP_DATE = STR_TO_DATE(#{compDate},'%Y-%m-%d'),</if>
- <if test="note != null and note != ''">NOTE = #{note},</if>
- <if test="effDate != null and effDate != ''">EFF_DATE = STR_TO_DATE(#{effDate},'%Y-%m-%d %H:%i:%s'),</if>
- <if test="exprDate != null and exprDate != ''">EXPR_DATE = STR_TO_DATE(#{exprDate},'%Y-%m-%d %H:%i:%s'),
- </if>
- </trim>
- <include refid="page_where"/>
- </update>
- <!-- 其他自定义SQL -->
- <select id="queryListByObjId" resultMap="attCwsBaseResultMap" parameterType="string">
- SELECT A.EDTR_PESR ,
- DATE_FORMAT(A.UPTM,'%Y-%m-%d %H:%i:%s') UPTM,
- A.CENTER_X_GD ,
- A.CENTER_Y_GD ,
- A.ADDVCD ,
- A.GUID ,
- A.CWS_CODE ,
- A.CWS_NAME ,
- A.CWS_LONG ,
- A.CWS_LAT ,
- A.CWS_LOC ,
- A.ENG_TYPE ,
- A.WASU_TYPE ,
- A.WASU_RANG ,
- A.DES_WASU_SCAL ,
- A.DES_WASU_POP ,
- A.ENG_STAT ,
- A.START_DATE ,
- DATE_FORMAT(COMP_DATE,'%Y-%m-%d') COMP_DATE,
- DATE_FORMAT(COMP_DATE,'%Y') COMP_YEAR,
- A.NOTE ,
- DATE_FORMAT(A.EFF_DATE,'%Y-%m-%d %H:%i:%s') EFF_DATE,
- DATE_FORMAT(A.EXPR_DATE,'%Y-%m-%d %H:%i:%s') EXPR_DATE
- FROM ATT_CWS_BASE A
- RIGHT JOIN BIS_INSP_VLGDRINK_PROJ_MANAGE B
- ON A.CWS_CODE=B.CWS_CODE WHERE
- B.ENG_ID=#{engId} AND A.ADDVCD=#{adCode} AND A.EXPR_DATE IS NULL
- <if test="name !=null and name !=''">
- AND A.CWS_NAME LIKE CONCAT('%', #{name}, '%')
- </if>
- ORDER BY A.GUID
- </select>
- <select id="queryListByObjIdNotDC" resultMap="attCwsBaseResultMap" parameterType="string">
- SELECT A.EDTR_PESR ,
- DATE_FORMAT(A.UPTM,'%Y-%m-%d %H:%i:%s') UPTM,
- A.CENTER_X_GD ,
- A.CENTER_Y_GD ,
- A.ADDVCD ,
- A.GUID ,
- A.CWS_CODE ,
- A.CWS_NAME ,
- A.CWS_LONG ,
- A.CWS_LAT ,
- A.CWS_LOC ,
- A.ENG_TYPE ,
- A.WASU_TYPE ,
- A.WASU_RANG ,
- A.DES_WASU_SCAL ,
- A.DES_WASU_POP ,
- A.ENG_STAT ,
- A.START_DATE ,
- DATE_FORMAT(COMP_DATE,'%Y-%m-%d') COMP_DATE,
- DATE_FORMAT(COMP_DATE,'%Y') COMP_YEAR,
- A.NOTE ,
- DATE_FORMAT(A.EFF_DATE,'%Y-%m-%d %H:%i:%s') EFF_DATE,
- DATE_FORMAT(A.EXPR_DATE,'%Y-%m-%d %H:%i:%s') EXPR_DATE
- FROM ATT_CWS_BASE A
- left JOIN BIS_INSP_VLGDRINK_PROJ_MANAGE B
- ON A.CWS_CODE=B.CWS_CODE WHERE
- ( B.ENG_ID!=#{engId} OR B.ENG_ID IS NULL)
- AND A.ADDVCD=#{adCode} AND A.EXPR_DATE IS NULL
- <if test="name !=null and name !=''">
- AND A.CWS_NAME LIKE CONCAT('%', #{name}, '%')
- </if>
- ORDER BY A.GUID
- </select>
- <select id="getMaxCwsCode" parameterType="string" resultType="string">
- SELECT MAX(CWS_CODE) FROM att_cws_base WHERE ADDVCD=#{adCode}
- </select>
- <select id="queryListWithStatus" resultType="cn.com.goldenwater.dcproj.dto.AttCwsBaseDto" parameterType="string">
- SELECT A.EDTR_PESR ,
- DATE_FORMAT(A.UPTM,'%Y-%m-%d %H:%i:%s') UPTM,
- A.CENTER_X_GD ,
- A.CENTER_Y_GD ,
- A.ADDVCD ,
- A.GUID ,
- A.CWS_CODE ,
- A.CWS_NAME ,
- A.CWS_LONG ,
- A.CWS_LAT ,
- A.CWS_LOC ,
- A.ENG_TYPE ,
- A.WASU_TYPE ,
- A.WASU_RANG ,
- A.DES_WASU_SCAL ,
- A.DES_WASU_POP ,
- A.ENG_STAT ,
- A.START_DATE ,
- DATE_FORMAT(COMP_DATE,'%Y-%m-%d') COMP_DATE,
- DATE_FORMAT(COMP_DATE,'%Y') COMP_YEAR,
- A.NOTE ,
- DATE_FORMAT(A.EFF_DATE,'%Y-%m-%d %H:%i:%s') EFF_DATE,
- DATE_FORMAT(A.EXPR_DATE,'%Y-%m-%d %H:%i:%s') EXPR_DATE,
- CASE WHEN B.ENG_ID = #{engId} THEN 1 ELSE 0 end STATUS
- FROM att_cws_base A
- LEFT JOIN BIS_INSP_VLGDRINK_PROJ_MANAGE B
- ON A.CWS_CODE = B.CWS_CODE
- WHERE A.ADDVCD = #{adCode} AND A.EXPR_DATE IS NULL
- <if test="name !=null and name !=''">
- AND A.CWS_NAME LIKE CONCAT('%', #{name}, '%')
- </if>
- order by status desc,A.EFF_DATE DESC
- </select>
- <select id="queryListByRegstrIdNotDC" resultType="cn.com.goldenwater.dcproj.model.AttCwsBase" parameterType="cn.com.goldenwater.dcproj.param.CwsParam">
- SELECT *
- FROM
- (
- SELECT
- E.*, F.STATUS
- FROM ATT_CWS_BASE E
- LEFT JOIN
- <choose>
- <when test="type=='25'.toString()">
- (SELECT CWS_CODE, IFNULL(STATUS, '0') STATUS FROM BIS_NEW_COUNTRY_FEE) F
- </when>
- <otherwise>
- (SELECT CWS_CODE, IFNULL(STATUS, '0') STATUS FROM BIS_ZHEJIANG_COUNTRY_FEE) F
- </otherwise>
- </choose>
- ON E.CWS_CODE=F.CWS_CODE
- ) S
- WHERE
- S.STATUS='0'
- <if test="name !=null and name !=''">
- AND S.CWS_NAME LIKE '%${name}%'
- </if>
- <if test="adCode !=null and adCode !=''">
- AND S.ADDVCD LIKE '${adCode}%'
- </if>
- <if test="engType !=null and engType !=''">
- AND S.ENG_TYPE =#{engType}
- </if>
- </select>
- </mapper>
|