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.

93 lines
4.5 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="org.springblade.modules.operation.mapper.OperationSiteMapper">
<!-- 通用查询映射结果 -->
<resultMap id="operationSiteResultMap" type="org.springblade.modules.operation.pojo.entity.OperationSiteEntity">
</resultMap>
<select id="selectOperationSitePage" resultType="org.springblade.modules.operation.pojo.vo.OperationSiteVO">
SELECT s.*,(SELECT count(id) FROM sf_operation_site_employee e where e.site_id = s.id and e.is_deleted='0' and e.role != 1) as amount,
(SELECT count(r.id) FROM sf_operation_site_employee r where r.site_id = s.id and r.is_deleted='0' and r.role=1) as empamount
FROM sf_operation_site s
WHERE s.status != '1'
<if test="operationSite.name !=null and operationSite.name != ''">
and s.name like CONCAT('%',#{operationSite.name}, '%')
</if>
<if test="operationSite.contacts !=null and operationSite.contacts != ''">
and s.contacts = #{operationSite.contacts}
</if>
<if test="operationSite.mobile !=null and operationSite.mobile != ''">
and s.mobile = #{operationSite.mobile}
</if>
<if test="operationSite.address!=null and operationSite.address != ''">
and concat(s.province, s.city, s.area, s.address) like CONCAT('%', #{operationSite.address}, '%')
</if>
order by s.create_time desc
</select>
<select id="selectOperationSiteList" resultType="org.springblade.modules.operation.excel.OperationSiteExcel">
SELECT s.*,(SELECT count(id) FROM sf_operation_site_employee e where e.site_id = s.id and e.is_deleted='0' and e.role != 1) as amount,
(SELECT count(r.id) FROM sf_operation_site_employee r where r.site_id = s.id and r.is_deleted='0' and r.role=1) as empamount
FROM sf_operation_site s
WHERE s.status != '1'
<if test="operationSite.name !=null and operationSite.name != ''">
and s.name like CONCAT('%',#{operationSite.name}, '%')
</if>
<if test="operationSite.contacts !=null and operationSite.contacts != ''">
and s.contacts = #{operationSite.contacts}
</if>
<if test="operationSite.mobile !=null and operationSite.mobile != ''">
and s.mobile = #{operationSite.mobile}
</if>
<if test="operationSite.address!=null and operationSite.address != ''">
and concat(s.province, s.city, s.area, s.address) like CONCAT('%', #{operationSite.address}, '%')
</if>
order by s.create_time desc
</select>
<select id="findSiteAmountPage" resultType="org.springblade.modules.operation.pojo.vo.OperationSiteVO">
SELECT s.*,(SELECT count(id) FROM sf_operation_order_settle e where e.site_id = s.id and e.status='0' ) as orderSetCount
FROM sf_operation_site s
WHERE s.status != '1'
<if test="operationSite.name !=null and operationSite.name != ''">
and s.name = #{operationSite.name}
</if>
<if test="operationSite.contacts !=null and operationSite.contacts != ''">
and s.contacts = #{operationSite.contacts}
</if>
<if test="operationSite.mobile !=null and operationSite.mobile != ''">
and s.mobile = #{operationSite.mobile}
</if>
<if test="operationSite.address!=null and operationSite.address != ''">
and concat(s.province, s.city, s.area, s.address) like CONCAT('%', #{operationSite.address}, '%')
</if>
order by s.create_time desc
</select>
<select id="findSiteList" resultType="org.springblade.modules.operation.pojo.vo.OperationSiteVO">
SELECT s.*
FROM sf_operation_site s
WHERE s.status != '1'
order by s.create_time desc
</select>
<select id="exportOperationSite" resultType="org.springblade.modules.operation.excel.EntrySiteExcel">
SELECT * FROM sf_operation_site ${ew.customSqlSegment}
</select>
<select id="getSiteDetail" resultType="org.springblade.modules.operation.pojo.vo.OperationSiteVO">
SELECT s.*,u.account as loginName
FROM sf_operation_site s
LEFT JOIN blade_user u on s.user_id = u.id
WHERE s.status != '1' and s.id = #{siteId}
</select>
<select id="findSiteByUserId" resultType="org.springblade.modules.operation.pojo.entity.OperationSiteEntity">
SELECT * FROM sf_operation_site where user_id= #{userId}
</select>
</mapper>