日照智慧社区接口服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.9 KiB

<?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.epmet.dao.CodeCustomerDao">
<resultMap type="com.epmet.entity.CodeCustomerEntity" id="codeCustomerMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="customerName" column="CUSTOMER_NAME"/>
<result property="templateId" column="TEMPLATE_ID"/>
<result property="clientType" column="CLIENT_TYPE"/>
<result property="appId" column="APP_ID"/>
<result property="extJson" column="EXT_JSON"/>
<result property="userVersion" column="USER_VERSION"/>
<result property="userDesc" column="USER_DESC"/>
<result property="status" column="STATUS"/>
<result property="revision" column="REVISION"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="selectCodeList" resultType="com.epmet.dto.result.UploadListResultDTO" parameterType="com.epmet.dto.form.UploadListFormDTO">
SELECT
cc.ID,
cc.CUSTOMER_ID,
cc.CUSTOMER_NAME,
cc.CLIENT_TYPE,
cc.APP_ID,
cc.USER_VERSION AS "version",
cc.USER_DESC AS "codeInfo",
cc.STATUS,
DATE_FORMAT(cc.CREATED_TIME,'%Y-%m-%d %T') AS "uploadTime",
IFNULL(DATE_FORMAT(car.CREATED_TIME,'%Y-%m-%d %T'),'') AS "auditTime",
car.AUDIT_ID
FROM code_customer cc
LEFT JOIN code_audit_result car ON cc.ID = car.CODE_ID AND car.DEL_FLAG = '0'
WHERE
cc.DEL_FLAG = '0'
<if test="customerId != null and customerId.trim() != ''">
AND cc.CUSTOMER_ID = #{customerId}
</if>
<if test="clientType != null and clientType.trim() != ''">
AND cc.CLIENT_TYPE = #{clientType}
</if>
<if test="status != null and status.trim() != ''">
AND cc.STATUS = #{status}
</if>
<if test="startTime != null and startTime.trim() != ''">
AND DATE_FORMAT(cc.CREATED_TIME, '%Y-%m-%d') <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime.trim() != ''">
AND DATE_FORMAT(cc.CREATED_TIME, '%Y-%m-%d') <![CDATA[ <= ]]> #{endTime}
</if>
</select>
<!-- 根据客户id和客户端类型获取 代码模板ID和授权方AppId -->
<select id="selectTemplateAndAppId" resultType="com.epmet.dto.result.TemplateAndAppIdResultDTO">
SELECT
template_id AS templateId,
app_id AS authAppId
FROM
code_customer
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND client_type = #{clientType}
</select>
<!-- 查询 code_customer 表ID -->
<select id="selectCodeCustomerId" resultType="java.lang.String">
SELECT
id AS id
FROM
code_customer
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND client_type = #{clientType}
AND app_id = #{authAppId}
AND template_id = #{templateId}
</select>
<select id="selectAuditingCodeList" resultType="com.epmet.dto.CodeCustomerDTO">
select * FROM code_customer WHERE DEL_FLAG = '0' AND STATUS = 'auditing'
</select>
<update id="deleteCode">
UPDATE code_customer
SET
DEL_FLAG = '1'
WHERE CUSTOMER_ID = #{customerId}
AND CLIENT_TYPE = #{clientType}
AND DEL_FLAG = '0'
</update>
</mapper>