新需求修改
This commit is contained in:
@@ -36,30 +36,36 @@
|
||||
<result property="createdBy" column="created_by" />
|
||||
<result property="createdAt" column="created_at" />
|
||||
<result property="remark" column="remark" />
|
||||
|
||||
<result property="customerName" column="customer_name" />
|
||||
<result property="salesPersonName" column="sales_person_name" />
|
||||
<result property="customerPhone" column="customer_phone" />
|
||||
<result property="customerAddress" column="customer_address" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSxSheepSaleVo">
|
||||
select id, bs_manage_tags, sheepfold_id, variety, sheep_name, gender, month_age, parity, breed, post_lambing_day, lactation_day, lambing_day, event_type, sale_date, pricing_method, unit_price, total_price, total_weight, avg_weight, avg_price_per_sheep, sale_type, disease_type, secondary_reason, group_code, customer_id, sales_person_id, quarantine_no, approval_no, technician_id, handler_id, created_by, created_at, remark from sx_sheep_sale
|
||||
SELECT
|
||||
s.id, s.bs_manage_tags, s.sheepfold_id, s.variety, s.sheep_name, s.gender, s.month_age, s.parity, s.breed,
|
||||
s.post_lambing_day, s.lactation_day, s.lambing_day, s.event_type, s.sale_date, s.pricing_method,
|
||||
s.unit_price, s.total_price, s.total_weight, s.avg_weight, s.avg_price_per_sheep, s.sale_type,
|
||||
s.disease_type, s.secondary_reason, s.group_code, s.customer_id, s.sales_person_id,
|
||||
s.quarantine_no, s.approval_no, s.technician_id, s.handler_id, s.created_by, s.created_at, s.remark,
|
||||
c.name AS customer_name,
|
||||
c.phone AS customer_phone,
|
||||
CONCAT(IFNULL(c.province,''), IFNULL(c.city,''), IFNULL(c.district,''), IFNULL(c.address,'')) AS customer_address,
|
||||
u.nick_name AS sales_person_name
|
||||
FROM sx_sheep_sale s
|
||||
LEFT JOIN sx_customer c ON s.customer_id = c.id
|
||||
LEFT JOIN sys_user u ON s.sales_person_id = u.user_id
|
||||
</sql>
|
||||
|
||||
<!-- 【新增】根据耳号查询羊只信息的SQL片段 -->
|
||||
<sql id="selectSheepFileVo">
|
||||
select
|
||||
bs_manage_tags,
|
||||
variety,
|
||||
name as sheep_name,
|
||||
gender,
|
||||
month_age,
|
||||
parity,
|
||||
breed,
|
||||
post_lambing_day,
|
||||
lactation_day,
|
||||
lambing_day,
|
||||
sheepfold_id
|
||||
bs_manage_tags, variety, name as sheep_name, gender, month_age, parity, breed,
|
||||
post_lambing_day, lactation_day, lambing_day, sheepfold_id
|
||||
from sheep_file
|
||||
</sql>
|
||||
|
||||
<!-- 【新增】根据耳号查询羊只信息 -->
|
||||
<select id="selectSheepInfoByTag" parameterType="String" resultMap="SxSheepSaleResult">
|
||||
<include refid="selectSheepFileVo"/>
|
||||
where bs_manage_tags = #{bsManageTags}
|
||||
@@ -68,18 +74,26 @@
|
||||
<select id="selectSxSheepSaleList" parameterType="SxSheepSale" resultMap="SxSheepSaleResult">
|
||||
<include refid="selectSxSheepSaleVo"/>
|
||||
<where>
|
||||
<if test="bsManageTags != null and bsManageTags != ''"> and bs_manage_tags = #{bsManageTags}</if>
|
||||
<if test="sheepfoldId != null "> and sheepfold_id = #{sheepfoldId}</if>
|
||||
<if test="variety != null and variety != ''"> and variety = #{variety}</if>
|
||||
<if test="sheepName != null and sheepName != ''"> and sheep_name = #{sheepName}</if>
|
||||
<if test="saleDate != null"> and sale_date = #{saleDate}</if>
|
||||
<if test="saleType != null and saleType != ''"> and sale_type = #{saleType}</if>
|
||||
<if test="customerName != null and customerName != ''">
|
||||
AND c.name LIKE CONCAT('%', #{customerName}, '%')
|
||||
</if>
|
||||
|
||||
<if test="salesPersonName != null and salesPersonName != ''">
|
||||
AND u.nick_name LIKE CONCAT('%', #{salesPersonName}, '%')
|
||||
</if>
|
||||
|
||||
<if test="params.beginSaleDate != null and params.beginSaleDate != ''">
|
||||
AND date_format(s.sale_date,'%y%m%d') >= date_format(#{params.beginSaleDate},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.endSaleDate != null and params.endSaleDate != ''">
|
||||
AND date_format(s.sale_date,'%y%m%d') <= date_format(#{params.endSaleDate},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSxSheepSaleById" parameterType="Long" resultMap="SxSheepSaleResult">
|
||||
<include refid="selectSxSheepSaleVo"/>
|
||||
where id = #{id}
|
||||
where s.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSxSheepSale" parameterType="SxSheepSale" useGeneratedKeys="true" keyProperty="id">
|
||||
|
||||
Reference in New Issue
Block a user