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.
spms-java/api-admin/src/main/resources/mybatis/mapper/auth/CustomerInfoDao.xml

129 lines
5.4 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.sale.admin.dao.auth.CustomerInfoDao">
<select id="filterCustomerInfo" parameterType="com.glxp.sale.admin.req.auth.CustomerInfoFilterRequest"
resultType="com.glxp.sale.admin.entity.auth.CustomerInfoEntity">
SELECT *
FROM customer_info
<where>
<if test="customerName != null and ''!=customerName">
AND customerName LIKE concat('%',#{customerName},'%')
</if>
<if test="companyName != null and ''!=companyName">
AND companyName LIKE concat('%',#{companyName},'%')
</if>
<if test="key != null and ''!=key">
AND (
companyName LIKE concat('%',#{key},'%')
or customerName LIKE concat('%',#{key},'%')
)
</if>
</where>
</select>
<select id="filterDetailCustomerInfo" parameterType="com.glxp.sale.admin.req.auth.CustomerInfoFilterRequest"
resultType="com.glxp.sale.admin.entity.auth.CustomerDetailEntity">
SELECT customer_info.customerId,customer_info.customerName,
customer_info.creditNum,customer_info.area,customer_info.detailAddr,
customer_info.bussinessStatus,customer_info.isInfoLink,customer_info.infoLink,customer_info.roleId,customer_info.userFlag,
customer_contact.contacts,customer_contact.mobile,customer_info.userMax,customer_contact.email,customer_contact.tel,customer_info.companyName
,auth_role.`name` role
FROM customer_info
left JOIN customer_contact on customer_info.customerId=customer_contact.customerId
left JOIN auth_role on customer_info.roleId = auth_role.id
<where>
<if test="customerName != null and ''!=customerName">
AND customer_info.customerName LIKE concat('%',#{customerName},'%')
</if>
<if test="companyName != null and ''!=companyName">
AND customer_info.companyName LIKE concat('%',#{companyName},'%')
</if>
</where>
</select>
<select id="selectDetail" parameterType="java.lang.String"
resultType="com.glxp.sale.admin.entity.auth.CustomerDetailEntity">
SELECT customer_info.customerId,
customer_info.customerName,
customer_info.creditNum,
customer_info.area,
customer_info.detailAddr,
customer_info.bussinessStatus,
customer_info.isInfoLink,
customer_info.infoLink,
customer_info.roleId,
customer_info.userFlag,
customer_contact.contacts,
customer_contact.mobile,
customer_info.userMax,
customer_contact.email,
customer_contact.tel,
customer_info.companyName
FROM customer_info
INNER JOIN customer_contact on customer_info.customerId = customer_contact.customerId
where customer_info.customerId = #{customerId}
</select>
<insert id="insertCustomerInfo" keyProperty="customerId"
parameterType="com.glxp.sale.admin.entity.auth.CustomerInfoEntity">
INSERT INTO customer_info
(customerId, customerName, creditNum,
area, detailAddr, bussinessStatus,
userFlag, isInfoLink, infoLink,
roleId, comments, userMax, companyName)
values (#{customerId}, #{customerName}, #{creditNum},
#{area}, #{detailAddr}, #{bussinessStatus},
#{userFlag}, #{isInfoLink}, #{infoLink},
#{roleId},
#{comments},
#{userMax}, #{companyName})
</insert>
<update id="updateCustomerInfo" parameterType="com.glxp.sale.admin.entity.auth.CustomerInfoEntity">
UPDATE customer_info
<set>
<if test="customerName != null">customerName=#{customerName},</if>
<if test="creditNum != null">creditNum=#{creditNum},</if>
<if test="area != null">`area`=#{area},</if>
<if test="detailAddr != null">detailAddr=#{detailAddr},</if>
<if test="bussinessStatus != null">`bussinessStatus`=#{bussinessStatus},</if>
<if test="userFlag != null">userFlag=#{userFlag},</if>
<if test="isInfoLink != null">isInfoLink=#{isInfoLink},</if>
<if test="infoLink != null">infoLink=#{infoLink},</if>
<if test="roleId != null">roleId=#{roleId},</if>
<if test="userMax != null">userMax=#{userMax},</if>
<if test="companyName != null">companyName=#{companyName},</if>
</set>
WHERE customerId=#{customerId}
</update>
<delete id="deleteById" parameterType="java.lang.String">
delete
from customer_info
where customerId = #{customerId}
</delete>
<select id="selectById" parameterType="java.lang.String"
resultType="com.glxp.sale.admin.entity.auth.CustomerInfoEntity">
SELECT *
FROM customer_info
WHERE (
customerId = #{customerId}) limit 1
</select>
<select id="isExitRoleId" parameterType="java.lang.String"
resultType="com.glxp.sale.admin.entity.auth.CustomerInfoEntity">
SELECT *
FROM customer_info
WHERE (
roleId = #{roleId}) limit 1
</select>
</mapper>