| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?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.sqx.modules.errand.dao.ErrandComplaintDao">
- <select id="findAppComplaint" resultType="com.sqx.modules.errand.entity.ErrandComplaint">
- select ec.*, eit.illegal as illegal, tu.nick_name as nickName, ti.shop_address_detail as shopAddressDetail,
- ti.user_address_detail as userAddressDetail
- from errand_complaint ec
- left join errand_illegal_type eit on ec.illegal_id = eit.id
- left join tb_user tu on ec.rider_user_id = tu.user_id
- left join tb_indent ti on ec.indent_number = ti.indent_number
- where 1 = 1
- <if test="userId!=null">
- and ec.rider_user_id = #{userId}
- </if>
- <if test="illegalId!=null">
- and ec.illegal_id = #{illegalId}
- </if>
- <if test="complaintState!=null">
- and ec.complaint_state = #{complaintState}
- </if>
- <if test="complaintState==null">
- and ec.complaint_state in (1, 2, 3, 4)
- </if>
- order by ec.complaint_time desc
- </select>
- <select id="findComplaint" resultType="com.sqx.modules.errand.entity.ErrandComplaint">
- select ec.*, eit.illegal as illegal, tu.nick_name as nickName, ti.shop_address_detail as shopAddressDetail,
- ti.user_address_detail as userAddressDetail, sit.illegal as shopIllegal
- from errand_complaint ec
- left join errand_illegal_type eit on ec.illegal_id = eit.id
- left join shop_illegal_type sit on ec.shop_illegal_id = sit.id
- left join tb_user tu on ec.rider_user_id = tu.user_id
- left join tb_indent ti on ec.indent_number = ti.indent_number
- where complaint_id = #{complaintId}
- </select>
- <select id="findAllComplaint" resultType="com.sqx.modules.errand.entity.ErrandComplaint">
- select ec.*, eit.illegal as illegal, tu.nick_name as nickName, ti.shop_address_detail as shopAddressDetail,
- ti.user_address_detail as userAddressDetail, sit.illegal as shopIllegal
- from errand_complaint ec
- left join errand_illegal_type eit on ec.illegal_id = eit.id
- left join shop_illegal_type sit on ec.shop_illegal_id = sit.id
- left join tb_user tu on ec.rider_user_id = tu.user_id
- left join tb_indent ti on ec.indent_number = ti.indent_number
- where 1 = 1
- <if test="userId!=null">
- and ec.rider_user_id = #{userId}
- </if>
- <if test="illegalId!=null">
- and ec.illegal_id = #{illegalId}
- </if>
- <if test="complaintState!=null">
- and ec.complaint_state = #{complaintState}
- </if>
- <if test="indentNumber!=null and indentNumber!=''">
- and ec.indent_number = #{indentNumber}
- </if>
- order by ec.complaint_time desc
- </select>
- <select id="deductMoneySum" resultType="java.math.BigDecimal">
- select ifnull(sum(deduct_money), 0) from errand_complaint where 1 = 1
- <if test="query.startTime!=null and query.startTime!=''">
- and complaint_time>=#{query.startTime}
- </if>
- <if test="query.endTime!=null and query.endTime!=''">
- and complaint_time <![CDATA[<=]]> #{query.endTime}
- </if>
- and complaint_state = 3
- </select>
- <select id="selectComplaintList" resultType="com.sqx.modules.errand.entity.ErrandComplaint">
- select * from errand_complaint where rider_user_id = #{userId} and complaint_state = 5
- </select>
- <select id="selectComplaint" resultType="com.sqx.modules.errand.entity.ErrandComplaint">
- select ec.*, ti.shop_address_detail as shopAddressDetail, ti.user_address_detail as userAddressDetail,
- sit.illegal as shopIllegal, sit.forfeit_money as shopForfeitMoney, tu.nick_name as nickName, tu.avatar as avatar
- from errand_complaint ec left join tb_indent ti on ec.indent_number = ti.indent_number
- left join shop_illegal_type sit on ec.shop_illegal_id = sit.id
- left join tb_user tu on ec.rider_user_id = tu.user_id
- where ec.shop_id = #{shopId} and ec.complaint_state in (1, 5, 6)
- order by complaint_time desc
- </select>
- <select id="selectUserComplaint" resultType="com.sqx.modules.errand.entity.ErrandComplaint">
- select ec.*, ti.shop_address_detail as shopAddressDetail, ti.user_address_detail as userAddressDetail,
- eit.illegal as illegal, eit.forfeit_money as forfeitMoney, tu.nick_name as nickName, tu.avatar as avatar
- from errand_complaint ec left join tb_indent ti on ec.indent_number = ti.indent_number
- left join errand_illegal_type eit on ec.illegal_id = eit.id
- left join tb_user tu on ec.rider_user_id = tu.user_id
- where ec.user_id = #{userId}
- order by complaint_time desc
- </select>
- </mapper>
|