123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <?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.caimei.modules.product.dao.CmSecondHandTransactionDao">
- <sql id="cmSecondHandTransactionColumns">
- a.id AS "id",
- a.userId AS "userId",
- ifnull(a.type,0) AS "type",
- ifnull(a.sold,0) AS "sold",
- ifnull(a.viewingNum,0) AS "viewingNum",
- a.transactionType AS "transactionType",
- a.productType AS "productType",
- a.productName AS "productName",
- a.productQuality AS "productQuality",
- a.address AS "address",
- a.contactName AS "contactName",
- a.contactMobile AS "contactMobile",
- a.fixedYears AS "fixedYears",
- a.mechanismName AS "mechanismName",
- a.image1 AS "image1",
- a.image2 AS "image2",
- a.image3 AS "image3",
- a.image4 AS "image4",
- a.image5 AS "image5",
- a.productDetails AS "productDetails",
- date_format(a.submitDate, '%Y-%m-%d %H:%i:%s') AS submitDate,
- date_format(a.updateDate, '%Y-%m-%d %H:%i:%s') AS updateDate,
- a.operationType AS operationType,
- a.payStatus AS payStatus,
- a.productStatus AS productStatus,
- a.payAmount AS payAmount,
- a.provinceCityDistrict AS provinceCityDistrict,
- a.townId AS townId,
- a.brandId AS brandId,
- (case when a.brandId != '-1' then
- (select cb.name from cm_brand cb where cb.id = a.brandId)
- else
- a.brandName
- end
- ) AS brandName,
- a.useBalanceAmount AS useBalanceAmount,
- a.revieweReason AS revieweReason,
- a.payFormData AS payFormData,
- date_format(a.reviewedDate, '%Y-%m-%d %H:%i:%s') AS reviewedDate,
- date_format(a.onLineDate, '%Y-%m-%d %H:%i:%s') AS onLineDate,
- a.reviewerUserID AS reviewerUserID,
- a.source AS source,
- (select su.name from sys_user su where su.id = a.reviewerUserID) AS reviewerUserName
- </sql>
- <sql id="cmSecondHandTransactionJoins">
- </sql>
- <select id="get" resultType="CmSecondHandTransaction">
- SELECT
- <include refid="cmSecondHandTransactionColumns"/>
- FROM cm_second_hand_transaction a
- <include refid="cmSecondHandTransactionJoins"/>
- WHERE a.id = #{id}
- </select>
- <select id="brandList" resultType="com.caimei.modules.brand.entity.CmBrand">
- select b.id AS id, b.name AS name from cm_brand b
- where b.status = '1' and b.delFlag = '0' and b.description is not null and b.description != ''
- order by b.sort
- </select>
- <select id="findList" resultType="CmSecondHandTransaction">
- SELECT
- <include refid="cmSecondHandTransactionColumns"/>
- ,u.userName AS "userName"
- FROM cm_second_hand_transaction a
- LEFT JOIN user u ON u.userId = a.userId
- <include refid="cmSecondHandTransactionJoins"/>
- <where>
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- <if test="brandId != null and brandId != ''">
- AND a.brandId = #{brandId}
- </if>
- <if test="transactionType != null and transactionType != ''">
- AND a.transactionType = #{transactionType}
- </if>
- <if test="productType != null and productType != ''">
- AND a.productType = #{productType}
- </if>
- <if test="productName != null and productName != ''">
- AND a.productName LIKE concat('%',#{productName},'%')
- </if>
- <if test="payStatus != null and payStatus != ''">
- AND a.payStatus = #{payStatus}
- </if>
- <if test="source != null and source != ''">
- AND a.source = #{source}
- </if>
- <if test="productStatus != null and productStatus != ''">
- AND a.productStatus = #{productStatus}
- </if>
- <if test="operationType != null and operationType != ''">
- AND a.operationType = #{operationType}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by a.submitDate desc
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="CmSecondHandTransaction">
- SELECT
- <include refid="cmSecondHandTransactionColumns"/>
- FROM cm_second_hand_transaction a
- <include refid="cmSecondHandTransactionJoins"/>
- <where>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <insert id="insert" parameterType="CmSecondHandTransaction" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO cm_second_hand_transaction(
- userId,
- type,
- sold,
- viewingNum,
- productType,
- productName,
- productQuality,
- address,
- townId,
- contactName,
- contactMobile,
- fixedYears,
- mechanismName,
- image1,
- image2,
- image3,
- image4,
- image5,
- productDetails,
- submitDate,
- payStatus,
- productStatus,
- payAmount,
- provinceCityDistrict,
- brandId,
- brandName,
- useBalanceAmount,
- revieweReason,
- payFormData,
- reviewedDate,
- onLineDate,
- updateDate,
- reviewerUserID,
- source
- ) VALUES (
- #{userId},
- #{type},
- #{sold},
- #{viewingNum},
- #{productType},
- #{productName},
- #{productQuality},
- #{address},
- #{townId},
- #{contactName},
- #{contactMobile},
- #{fixedYears},
- #{mechanismName},
- #{image1},
- #{image2},
- #{image3},
- #{image4},
- #{image5},
- #{productDetails},
- #{submitDate},
- #{payStatus},
- #{productStatus},
- #{payAmount},
- #{provinceCityDistrict},
- #{brandId},
- #{brandName},
- #{useBalanceAmount},
- #{revieweReason},
- #{payFormData},
- #{reviewedDate},
- #{onLineDate},
- #{updateDate},
- #{reviewerUserID},
- #{source}
- )
- </insert>
- <update id="update">
- UPDATE cm_second_hand_transaction SET
- userId = #{userId},
- type = #{type},
- sold = #{sold},
- viewingNum = #{viewingNum},
- productType = #{productType},
- productName = #{productName},
- productQuality = #{productQuality},
- address = #{address},
- townId = #{townId},
- contactName = #{contactName},
- contactMobile = #{contactMobile},
- fixedYears = #{fixedYears},
- mechanismName = #{mechanismName},
- image1 = #{image1},
- image2 = #{image2},
- image3 = #{image3},
- image4 = #{image4},
- image5 = #{image5},
- productDetails = #{productDetails},
- submitDate = #{submitDate},
- payStatus = #{payStatus},
- productStatus = #{productStatus},
- payAmount = #{payAmount},
- provinceCityDistrict = #{provinceCityDistrict},
- brandId = #{brandId},
- brandName = #{brandName},
- useBalanceAmount = #{useBalanceAmount},
- revieweReason = #{revieweReason},
- payFormData = #{payFormData},
- reviewedDate = #{reviewedDate},
- onLineDate = #{onLineDate},
- updateDate = #{updateDate},
- reviewerUserID = #{reviewerUserID},
- source = #{source}
- WHERE id = #{id}
- </update>
- <delete id="delete">
- DELETE FROM cm_second_hand_transaction
- WHERE id = #{id}
- </delete>
- </mapper>
|