| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547 |
- <?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.goafanti.common.dao.TemporaryReceivablesMapper">
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.TemporaryReceivables">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- <id column="id" jdbcType="INTEGER" property="id" />
- <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
- <result column="corporate_name" jdbcType="VARCHAR" property="corporateName" />
- <result column="amount" jdbcType="DECIMAL" property="amount" />
- <result column="receivables_time" jdbcType="TIMESTAMP" property="receivablesTime" />
- <result column="aid" jdbcType="VARCHAR" property="aid" />
- <result column="remarks" jdbcType="VARCHAR" property="remarks" />
- <result column="status" jdbcType="INTEGER" property="status" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="financial_pay_no" jdbcType="VARCHAR" property="financialPayNo" />
- </resultMap>
- <sql id="Example_Where_Clause">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- <where>
- <foreach collection="oredCriteria" item="criteria" separator="or">
- <if test="criteria.valid">
- <trim prefix="(" prefixOverrides="and" suffix=")">
- <foreach collection="criteria.criteria" item="criterion">
- <choose>
- <when test="criterion.noValue">
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue">
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue">
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue">
- and ${criterion.condition}
- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Update_By_Example_Where_Clause">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- <where>
- <foreach collection="example.oredCriteria" item="criteria" separator="or">
- <if test="criteria.valid">
- <trim prefix="(" prefixOverrides="and" suffix=")">
- <foreach collection="criteria.criteria" item="criterion">
- <choose>
- <when test="criterion.noValue">
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue">
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue">
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue">
- and ${criterion.condition}
- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Base_Column_List">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- id, order_no, corporate_name, amount, receivables_time, aid, remarks, status, create_time,
- financial_pay_no
- </sql>
- <select id="selectByExample" parameterType="com.goafanti.common.model.TemporaryReceivablesExample" resultMap="BaseResultMap">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- select
- <if test="distinct">
- distinct
- </if>
- <include refid="Base_Column_List" />
- from temporary_receivables
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- <if test="orderByClause != null">
- order by ${orderByClause}
- </if>
- </select>
- <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- select
- <include refid="Base_Column_List" />
- from temporary_receivables
- where id = #{id,jdbcType=INTEGER}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- delete from temporary_receivables
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <delete id="deleteByExample" parameterType="com.goafanti.common.model.TemporaryReceivablesExample">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- delete from temporary_receivables
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- </delete>
- <insert id="insert" parameterType="com.goafanti.common.model.TemporaryReceivables">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- insert into temporary_receivables (id, order_no, corporate_name,
- amount, receivables_time, aid,
- remarks, status, create_time,
- financial_pay_no)
- values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{corporateName,jdbcType=VARCHAR},
- #{amount,jdbcType=DECIMAL}, #{receivablesTime,jdbcType=TIMESTAMP}, #{aid,jdbcType=VARCHAR},
- #{remarks,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
- #{financialPayNo,jdbcType=VARCHAR})
- </insert>
- <insert id="insertSelective" parameterType="com.goafanti.common.model.TemporaryReceivables">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- insert into temporary_receivables
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="orderNo != null">
- order_no,
- </if>
- <if test="corporateName != null">
- corporate_name,
- </if>
- <if test="amount != null">
- amount,
- </if>
- <if test="receivablesTime != null">
- receivables_time,
- </if>
- <if test="aid != null">
- aid,
- </if>
- <if test="remarks != null">
- remarks,
- </if>
- <if test="status != null">
- status,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="financialPayNo != null">
- financial_pay_no,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=INTEGER},
- </if>
- <if test="orderNo != null">
- #{orderNo,jdbcType=VARCHAR},
- </if>
- <if test="corporateName != null">
- #{corporateName,jdbcType=VARCHAR},
- </if>
- <if test="amount != null">
- #{amount,jdbcType=DECIMAL},
- </if>
- <if test="receivablesTime != null">
- #{receivablesTime,jdbcType=TIMESTAMP},
- </if>
- <if test="aid != null">
- #{aid,jdbcType=VARCHAR},
- </if>
- <if test="remarks != null">
- #{remarks,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- #{status,jdbcType=INTEGER},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="financialPayNo != null">
- #{financialPayNo,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <select id="countByExample" parameterType="com.goafanti.common.model.TemporaryReceivablesExample" resultType="java.lang.Long">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- select count(*) from temporary_receivables
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- </select>
- <update id="updateByExampleSelective" parameterType="map">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- update temporary_receivables
- <set>
- <if test="record.id != null">
- id = #{record.id,jdbcType=INTEGER},
- </if>
- <if test="record.orderNo != null">
- order_no = #{record.orderNo,jdbcType=VARCHAR},
- </if>
- <if test="record.corporateName != null">
- corporate_name = #{record.corporateName,jdbcType=VARCHAR},
- </if>
- <if test="record.amount != null">
- amount = #{record.amount,jdbcType=DECIMAL},
- </if>
- <if test="record.receivablesTime != null">
- receivables_time = #{record.receivablesTime,jdbcType=TIMESTAMP},
- </if>
- <if test="record.aid != null">
- aid = #{record.aid,jdbcType=VARCHAR},
- </if>
- <if test="record.remarks != null">
- remarks = #{record.remarks,jdbcType=VARCHAR},
- </if>
- <if test="record.status != null">
- status = #{record.status,jdbcType=INTEGER},
- </if>
- <if test="record.createTime != null">
- create_time = #{record.createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="record.financialPayNo != null">
- financial_pay_no = #{record.financialPayNo,jdbcType=VARCHAR},
- </if>
- </set>
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByExample" parameterType="map">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- update temporary_receivables
- set id = #{record.id,jdbcType=INTEGER},
- order_no = #{record.orderNo,jdbcType=VARCHAR},
- corporate_name = #{record.corporateName,jdbcType=VARCHAR},
- amount = #{record.amount,jdbcType=DECIMAL},
- receivables_time = #{record.receivablesTime,jdbcType=TIMESTAMP},
- aid = #{record.aid,jdbcType=VARCHAR},
- remarks = #{record.remarks,jdbcType=VARCHAR},
- status = #{record.status,jdbcType=INTEGER},
- create_time = #{record.createTime,jdbcType=TIMESTAMP},
- financial_pay_no = #{record.financialPayNo,jdbcType=VARCHAR}
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TemporaryReceivables">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- update temporary_receivables
- <set>
- <if test="orderNo != null">
- order_no = #{orderNo,jdbcType=VARCHAR},
- </if>
- <if test="corporateName != null">
- corporate_name = #{corporateName,jdbcType=VARCHAR},
- </if>
- <if test="amount != null">
- amount = #{amount,jdbcType=DECIMAL},
- </if>
- <if test="receivablesTime != null">
- receivables_time = #{receivablesTime,jdbcType=TIMESTAMP},
- </if>
- <if test="aid != null">
- aid = #{aid,jdbcType=VARCHAR},
- </if>
- <if test="remarks != null">
- remarks = #{remarks,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- status = #{status,jdbcType=INTEGER},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="financialPayNo != null">
- financial_pay_no = #{financialPayNo,jdbcType=VARCHAR},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TemporaryReceivables">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon Oct 14 11:33:48 CST 2019.
- -->
- update temporary_receivables
- set order_no = #{orderNo,jdbcType=VARCHAR},
- corporate_name = #{corporateName,jdbcType=VARCHAR},
- amount = #{amount,jdbcType=DECIMAL},
- receivables_time = #{receivablesTime,jdbcType=TIMESTAMP},
- aid = #{aid,jdbcType=VARCHAR},
- remarks = #{remarks,jdbcType=VARCHAR},
- status = #{status,jdbcType=INTEGER},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- financial_pay_no = #{financialPayNo,jdbcType=VARCHAR}
- where id = #{id,jdbcType=INTEGER}
- </update>
-
- <delete id="deleteByids" parameterType="java.util.List">
- delete from temporary_receivables
- where id in
- <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
- #{item}
- </foreach>
- </delete>
- <delete id="deleteByaid" parameterType="java.lang.String">
- delete from temporary_receivables
- where aid = #{aid}
- </delete>
- <delete id="deleteNormalByaid">
- delete from temporary_receivables
- where aid = #{aid} and status !=2
- </delete>
- <select id="selectByaid" resultMap="BaseResultMap">
-
- select
- <include refid="Base_Column_List" />
- from temporary_receivables
- where aid = #{aid,jdbcType=INTEGER}
- </select>
- <select id="selectReceivablesList" parameterType="java.lang.String" resultType="com.goafanti.order.bo.ReceivablesListBo">
- select a.id,a.order_no orderNo,b.contract_no contractNo,a.corporate_name corporateName,c.nickname,b.total_amount totalAmount,d.name depName,a.status ,b.settlement_amount settlementAmount,
- a.financial_pay_no financialPayNo,a.amount,date_format(a.receivables_time, '%Y-%m-%d')receivablesTimes,date_format(a.create_time, '%Y-%m-%d %H:%i:%S')createTimes,a.remarks
- from temporary_receivables a left join t_order_new b on a.order_no=b.order_no left join user c on b.buyer_id=c.id left join department d on b.order_dep=d.id
- left join admin e on b.salesman_id=e.id
- where 1=1
- <if test="aid != null">
- and a.aid= #{aid}
- </if>
- <if test="contractNo != null">
- b.contract_no like concat('%',#{contractNo},'%')
- </if>
- <if test="orderNo != null">
- and a.order_no = #{orderNo}
- </if>
- <if test="adminName != null">
- and e.name like concat('%',#{adminName},'%')
- </if>
- <if test="nickname != null">
- and c.nickname like concat('%',#{nickname},'%')
- </if>
- <if test="corporateName != null">
- and a.corporate_name like concat('%',#{corporateName},'%')
- </if>
- <if test="orderDepId != null">
- and b.order_dep= #{orderDepId}
- </if>
- <if test="adminDepId != null">
- and e.department_id= #{adminDepId}
- </if>
- <if test="status != null">
- and a.status= #{status}
- </if>
- order by a.status desc,b.contract_no,a.create_time desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="selectReceivablesCount" resultType="java.lang.Integer">
- select count(*) from temporary_receivables a left join t_order_new b on a.order_no=b.order_no left join user c on b.buyer_id=c.id left join department d on b.order_dep=d.id
- left join admin e on b.salesman_id=e.id
- where 1=1
- <if test="aid != null">
- and a.aid= #{aid}
- </if>
- <if test="contractNo != null">
- b.contract_no like concat('%',#{contractNo},'%')
- </if>
- <if test="orderNo != null">
- and a.order_no = #{orderNo}
- </if>
- <if test="adminName != null">
- and e.name like concat('%',#{adminName},'%')
- </if>
- <if test="nickname != null">
- and c.nickname like concat('%',#{nickname},'%')
- </if>
- <if test="corporateName != null">
- and a.corporate_name like concat('%',#{corporateName},'%')
- </if>
- <if test="orderDepId != null">
- and b.order_dep= #{orderDepId}
- </if>
- <if test="adminDepId != null">
- and e.department_id= #{adminDepId}
- </if>
- <if test="status != null">
- and a.status= #{status}
- </if>
- </select>
- <select id="getCountlistReceivablesAmount" parameterType="Map" resultType="java.lang.String">
- select ifnull(sum(a.amount),0) amount from temporary_receivables a left join t_order_new b on a.order_no=b.order_no
- left join user c on b.buyer_id=c.id left join department d on b.order_dep=d.id left join admin e on b.salesman_id=e.id
- where 1=1
- <if test="aid != null">
- and a.aid= #{aid}
- </if>
- <if test="contractNo != null">
- and b.contract_no like concat('%',#{contractNo},'%')
- </if>
- <if test="orderNo != null">
- and a.order_no = #{orderNo}
- </if>
- <if test="adminName != null">
- and b.salesman_id like concat('%',#{adminName},'%')
- </if>
- <if test="nickname != null">
- and c.nickname like concat('%',#{nickname},'%')
- </if>
- <if test="corporateName != null">
- and a.corporate_name like concat('%',#{corporateName},'%')
- </if>
- <if test="orderDepId != null">
- and b.order_dep= #{orderDepId}
- </if>
- <if test="adminDepId != null">
- and e.department_id= #{adminDepId}
- </if>
- <if test="status != null">
- and a.status= #{status}
- </if>
- </select>
-
- <select id="getCountlistReceivablesTotalAmount" parameterType="Map" resultType="java.lang.String">
- select ifnull(sum(x.total_amount),0) from (select b.order_no,b.total_amount from temporary_receivables a
- left join t_order_new b on a.order_no=b.order_no left join user c on b.buyer_id=c.id left join department d on b.order_dep=d.id
- left join admin e on b.salesman_id=e.id
- where 1=1
- <if test="aid != null">
- and a.aid= #{aid}
- </if>
- <if test="contractNo != null">
- and b.contract_no like concat('%',#{contractNo},'%')
- </if>
- <if test="orderNo != null">
- and a.order_no = #{orderNo}
- </if>
- <if test="adminName != null">
- and b.salesman_id like concat('%',#{adminName},'%')
- </if>
- <if test="nickname != null">
- and c.nickname like concat('%',#{nickname},'%')
- </if>
- <if test="corporateName != null">
- and a.corporate_name like concat('%',#{corporateName},'%')
- </if>
- <if test="orderDepId != null">
- and b.order_dep= #{orderDepId}
- </if>
- <if test="adminDepId != null">
- and e.department_id= #{adminDepId}
- </if>
- <if test="status != null">
- and a.status= #{status}
- </if>
- group by b.order_no)x
- </select>
-
- <insert id="insertBatch" parameterType="com.goafanti.common.model.TemporaryReceivables">
- insert into temporary_receivables (id, order_no, corporate_name, amount, receivables_time,
- aid, remarks, status, create_time, financial_pay_no) values
- <foreach item="item" index="index" collection="list" separator=",">
- (#{item.id,jdbcType=INTEGER}, #{item.orderNo,jdbcType=VARCHAR}, #{item.corporateName,jdbcType=VARCHAR},
- #{item.amount,jdbcType=DECIMAL}, #{item.receivablesTime,jdbcType=TIMESTAMP}, #{item.aid,jdbcType=VARCHAR},
- #{item.remarks,jdbcType=VARCHAR}, #{item.status,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP},
- #{item.financialPayNo,jdbcType=VARCHAR})
- </foreach>
- </insert>
-
- <update id="updateRepeatOrderNo" >
- update temporary_receivables x ,(select a.order_no,a.amount,a.receivables_time,a.nickname
- from (select a.order_no,a.corporate_name,a.amount,a.receivables_time,b.nickname,count(1) counts
- from temporary_receivables a left join (select x1.order_no,y1.nickname from t_order_new x1
- left join user y1 on x1.buyer_id=y1.id )b on a.order_no=b.order_no where a.corporate_name=b.nickname
- group by a.order_no,a.corporate_name,a.amount,a.receivables_time)a where a.counts>1 )y set x.status=1
- where x.order_no=y.order_no and x.amount=y.amount and x.receivables_time=y.receivables_time
- and x.corporate_name=y.nickname and a.aid= #{aid}
- </update>
- </mapper>
|