97 lines
3.5 KiB
XML
97 lines
3.5 KiB
XML
<?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="cn.iocoder.yudao.module.tickets.mapper.DlTwItemMapper">
|
|
|
|
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.tickets.entity.DlTwItem">
|
|
<result property="id" column="id" jdbcType="VARCHAR"/>
|
|
<result property="twId" column="tw_id" jdbcType="VARCHAR"/>
|
|
<result property="waresId" column="wares_id" jdbcType="VARCHAR"/>
|
|
<result property="waresName" column="wares_name" jdbcType="VARCHAR"/>
|
|
<result property="waresCount" column="wares_count" jdbcType="INTEGER"/>
|
|
<result property="waresAlreadyCount" column="wares_already_count" jdbcType="INTEGER"/>
|
|
<result property="waresStatus" column="wares_status" jdbcType="VARCHAR"/>
|
|
<result property="handleId" column="handle_id" jdbcType="INTEGER"/>
|
|
<result property="handleName" column="handle_name" jdbcType="VARCHAR"/>
|
|
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
|
</resultMap>
|
|
|
|
<sql id="Base_SQL">
|
|
select
|
|
id,
|
|
tw_id,
|
|
wares_id,
|
|
wares_name,
|
|
wares_count,
|
|
wares_already_count,
|
|
wares_status,
|
|
add_user_id,
|
|
add_user_name,
|
|
if_house_add,
|
|
handle_id,
|
|
handle_name,
|
|
remark
|
|
from dl_tw_item dti
|
|
where dti.deleted = '0'
|
|
</sql>
|
|
|
|
<select id="listTwItem" resultMap="BaseResultMap">
|
|
<include refid="Base_SQL" />
|
|
<if test="map.twId != null and map.twId != ''">
|
|
and dti.tw_id = #{map.twId}
|
|
</if>
|
|
<if test="map.query != null and map.query != ''">
|
|
and (
|
|
dti.wares_name like concat('%', #{map.query}, '%')
|
|
)
|
|
</if>
|
|
<if test="map.waresStatus != null and map.waresStatus != ''">
|
|
and dti.wares_status = #{map.waresStatus}
|
|
</if>
|
|
</select>
|
|
<select id="listTwItemApp" resultType="cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO">
|
|
SELECT
|
|
dti.id,
|
|
dti.tw_id,
|
|
dti.wares_id,
|
|
dti.wares_name,
|
|
dti.wares_count,
|
|
dti.wares_already_count,
|
|
dti.wares_status,
|
|
dti.add_user_id,
|
|
dti.add_user_name,
|
|
dti.if_house_add,
|
|
dti.handle_id,
|
|
dti.handle_name,
|
|
dti.update_time,
|
|
dti.remark,
|
|
drw.type AS type_id,
|
|
dbt.`name` AS type_name,
|
|
drw.price AS sale_price,
|
|
drw.stock AS stock,
|
|
sdd.label AS unit_text
|
|
FROM
|
|
dl_tw_item dti
|
|
LEFT JOIN dl_repair_wares drw ON dti.wares_id = drw.id
|
|
LEFT JOIN dl_base_type dbt ON drw.type = dbt.id
|
|
LEFT JOIN system_dict_data sdd ON drw.unit = sdd.`value` AND sdd.dict_type = 'repair_unit'
|
|
WHERE
|
|
dti.deleted = '0'
|
|
<if test="map.twId != null and map.twId != ''">
|
|
and dti.tw_id = #{map.twId}
|
|
</if>
|
|
<if test="map.query != null and map.query != ''">
|
|
and (
|
|
dti.wares_name like concat('%', #{map.query}, '%')
|
|
)
|
|
</if>
|
|
<if test="map.waresStatus != null and map.waresStatus != ''">
|
|
and dti.wares_status = #{map.waresStatus}
|
|
</if>
|
|
ORDER BY
|
|
drw.type,
|
|
dti.create_time
|
|
</select>
|
|
</mapper>
|