| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <?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.dk.mdm.mapper.ivt.FreezeMapper">
- <!-- 通用设置 -->
- <!-- 通用查询列 -->
- <sql id="Base_Column_List">
- freeze_id, freeze_no, cus_id, org_id, staff_id, freeze_status, freeze_date, auto_unfreeze_date, sum_quantity, remarks, make_staff, make_time, flg_valid, cp_id, op_create_time, op_create_user_id, op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user,annex_paths
- </sql>
- <!-- 冻结一览查询列 -->
- <sql id="Base_Column_List_Respons">
- fre.freeze_id,fre.freeze_no,fre.cus_id,fre.org_id,fre.staff_id,fre.freeze_status
- ,sys.f_get_name_i18n(tdk.kind_name_i18n, #{i18n} ) AS "freezeStatusName"
- ,fre.freeze_date,fre.auto_unfreeze_date ,fre.sum_quantity, fre.remarks, fre.make_staff
- , fre.make_time, fre.flg_valid,fre.cp_id,cus.cus_phone
- ,cus.cus_name,staff.staff_name,org.org_name,mstaff.staff_name AS "makeStaffName"
- ,fre.annex_paths
- </sql>
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.ivt.FreezeResponse">
- <id column="freeze_id" property="freezeId"/>
- <result column="freeze_no" property="freezeNo"/>
- <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
- <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
- <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
- <result column="freeze_status" property="freezeStatus"/>
- <result column="freeze_date" property="freezeDate" typeHandler="TimestampTypeHandler"/>
- <result column="auto_unfreeze_date" property="autoUnfreezeDate" typeHandler="TimestampTypeHandler"/>
- <result column="sum_quantity" property="sumQuantity"/>
- <result column="remarks" property="remarks"/>
- <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
- <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
- <result column="flg_valid" property="flgValid"/>
- <result column="cp_id" property="cpId"/>
- <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
- <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
- <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
- <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
- <result column="op_app_code" property="opAppCode"/>
- <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
- <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
- <result column="op_db_user" property="opDbUser"/>
- </resultMap>
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.ivt.Freeze">
- <id column="freeze_id" property="freezeId"/>
- <result column="freeze_no" property="freezeNo"/>
- <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
- <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
- <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
- <result column="freeze_status" property="freezeStatus"/>
- <result column="freeze_date" property="freezeDate" typeHandler="TimestampTypeHandler"/>
- <result column="auto_unfreeze_date" property="autoUnfreezeDate" typeHandler="TimestampTypeHandler"/>
- <result column="sum_quantity" property="sumQuantity"/>
- <result column="remarks" property="remarks"/>
- <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
- <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
- <result column="flg_valid" property="flgValid"/>
- <result column="cp_id" property="cpId"/>
- <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
- <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
- <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
- <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
- <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
- <result column="op_app_code" property="opAppCode"/>
- <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
- <result column="op_db_user" property="opDbUser"/>
- </resultMap>
- <!-- 通用条件列 -->
- <sql id="Condition">
- <where>
- <if test="freezeNo != null and freezeNo != ''">
- AND fre.freeze_no LIKE concat('%',my_ex.likequery(#{freezeNo}),'%')
- </if>
- <if test="cusId != null and cusId != ''">
- AND fre.cus_id = #{cusId}
- </if>
- <if test="orgId != null and orgId != ''">
- AND fre.org_id = #{orgId}
- </if>
- <if test="staffId != null and staffId != ''">
- AND fre.staff_id = #{staffId}
- </if>
- <if test="freezeStatus != null and freezeStatus != ''">
- AND fre.freeze_status = #{freezeStatus}
- </if>
- <if test="freezeDate != null">
- AND fre.freeze_date = #{freezeDate}
- </if>
- <if test="autoUnfreezeDate != null">
- AND fre.auto_unfreeze_date = #{autoUnfreezeDate}
- </if>
- <if test="remarks != null and remarks != ''">
- AND fre.remarks = #{remarks}
- </if>
- <if test="cpId != null">
- AND fre.cp_id = #{cpId}
- </if>
- <if test="flgValidList != null and flgValidList.size>0">
- AND fre.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
- </if>
- <if test="orgIdList != null and orgIdList.size>0">
- AND fre.org_id = any(#{orgIdList, typeHandler=UuidListTypeHandler})
- </if>
- <if test="staffIdList != null and staffIdList.size>0">
- AND fre.staff_id = any(#{staffIdList, typeHandler=UuidListTypeHandler})
- </if>
- <if test="cusName != null and cusName != ''">
- AND cus.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
- </if>
- <if test="freezeStatusList != null and freezeStatusList.size() > 0">
- AND fre.freeze_status = any(#{freezeStatusList, typeHandler=UuidListTypeHandler})
- </if>
- </where>
- </sql>
- <!-- 查询表t_psi_freeze,(条件查询+分页)列表 -->
- <select id="selectByCond" resultMap="BaseResultMapResponse">
- SELECT
- <include refid="Base_Column_List_Respons"/>
- FROM dkic_b.t_psi_freeze AS fre
- lEFT JOIN dkic_b.t_mst_customer AS cus ON cus.cus_id=fre.cus_id
- lEFT JOIN dkic_b.t_mst_staff AS staff ON staff.staff_id=fre.staff_id
- lEFT JOIN dkic_b.t_mst_org AS org ON org.org_id=fre.org_id
- lEFT JOIN dkic_b.t_mst_staff AS mstaff ON mstaff.staff_id=fre.make_staff
- LEFT JOIN sys.t_data_kind AS tdk ON tdk.kind_code = fre.freeze_status
- <include refid="Condition"/>
- <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
- limit #{end} offset #{start}
- </if>
- </select>
- <!-- 查询表t_psi_freeze,(条件查询)个数 -->
- <select id="countByCond" resultType="Long">
- SELECT
- count(1)
- FROM dkic_b.t_psi_freeze AS fre
- <include refid="Condition"/>
- </select>
- <!-- 根据主键查询表t_psi_freeze的一行数据 -->
- <select id="selectById" resultMap="BaseResultMapResponse">
- SELECT
- <include refid="Base_Column_List_Respons"/>
- FROM dkic_b.t_psi_freeze AS fre
- lEFT JOIN dkic_b.t_mst_customer AS cus ON cus.cus_id=fre.cus_id
- lEFT JOIN dkic_b.t_mst_staff AS staff ON staff.staff_id=fre.staff_id
- lEFT JOIN dkic_b.t_mst_org AS org ON org.org_id=fre.org_id
- lEFT JOIN dkic_b.t_mst_staff AS mstaff ON mstaff.staff_id=fre.make_staff
- LEFT JOIN sys.t_data_kind AS tdk ON tdk.kind_code = fre.freeze_status
- WHERE fre.freeze_id = #{id}::uuid
- </select>
- <!-- 根据主键锁定表t_psi_freeze的一行数据 -->
- <select id="selectByIdForUpdate" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM t_psi_freeze
- WHERE freeze_id = #{freezeId}
- for update
- </select>
- </mapper>
|