You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udi-cpt-java/src/main/resources/mybatis/mapper/sup/UserCertMapper.xml

91 lines
4.0 KiB
XML

<?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.glxp.api.dao.sup.UserCertMapper">
<resultMap id="BaseResultMap" type="com.glxp.api.entity.sup.UserCertEntity">
<!--@mbg.generated-->
<!--@Table user_cert-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="businessId" jdbcType="BIGINT" property="businessId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="filePath" jdbcType="LONGVARCHAR" property="filePath" />
<result column="validDate" jdbcType="TIMESTAMP" property="validDate" />
<result column="expireDate" jdbcType="TIMESTAMP" property="expireDate" />
<result column="checkStatus" jdbcType="CHAR" property="checkStatus" />
<result column="checkComment" jdbcType="VARCHAR" property="checkComment" />
<result column="status" jdbcType="CHAR" property="status" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="createUser" jdbcType="VARCHAR" property="createUser" />
<result column="createTime" jdbcType="TIMESTAMP" property="createTime" />
<result column="updateUser" jdbcType="VARCHAR" property="updateUser" />
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, businessId, `name`, code, filePath, validDate, expireDate, checkStatus, checkComment,
`status`, remark, `createUser`, createTime, updateUser, updateTime
</sql>
<select id="selectByRegisterId" parameterType="java.lang.String"
resultType="com.glxp.api.entity.sup.UserCertEntity">
SELECT a.id,c.name,c.isNeed,ifnull(a.businessId,#{registerId}) businessId,a.companyId,a.code,a.filePath,a.validDate,a.expireDate,a.checkStatus,a.checkTime,a.checkComment,a.status,a.remark
FROM user_cert_set c LEFT JOIN
(SELECT * from user_cert WHERE businessId=#{registerId}) a ON c.name = a.name
</select>
<select id="filterCompanyCert" parameterType="com.glxp.api.req.purchase.FilterSupCertRequest"
resultType="com.glxp.api.entity.sup.UserCertEntity">
-- select * from sup_cert
select * from user_cert
<where>
<if test="businessId != '' and businessId!=null">
and businessId = #{businessId}
</if>
<if test="customerId != '' and customerId!=null">
and customerId = #{customerId}
</if>
<if test="businessId != '' and businessId!=null">
and businessId = #{businessId}
</if>
<if test="manufacturerIdFk != '' and manufacturerIdFk!=null">
and manufacturerIdFk = #{manufacturerIdFk}
</if>
<if test="productIdFk != '' and productIdFk!=null">
and productIdFk = #{productIdFk}
</if>
<if test="type != '' and type!=null">
and `type` = #{type}
</if>
<if test="auditStatus != null and auditStatus !=20 and auditStatus !=24 and auditStatus !=25" >
and auditStatus = #{auditStatus}
</if>
<if test="auditStatus ==20">
and (auditStatus = 1 or auditStatus=4)
</if>
<if test="auditStatus ==24">
and (auditStatus = 2 or auditStatus=3 or auditStatus=5 or auditStatus=6)
</if>
<if test="auditStatus ==25">
and (auditStatus !=0)
</if>
</where>
ORDER BY id DESC
</select>
<select id="filterZcCert" parameterType="com.glxp.api.req.purchase.certRequest"
resultType="com.glxp.api.entity.sup.UserCertEntity">
-- select * from user_cert
SELECT uc.*
FROM user_cert uc
LEFT JOIN user_register ur ON uc.businessId = ur.companyId
<where>
<!-- <if test="businessId != '' and businessId!=null">-->
<!-- and businessId = #{businessId}-->
<!-- </if>-->
<if test="mobile != '' and mobile!=null">
and ur.mobile = #{mobile}
</if>
</where>
ORDER BY id DESC
</select>
</mapper>