148 lines
4.6 KiB
XML
148 lines
4.6 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="lingtao.net.dao.ProductImgMapper">
|
|
<!--获取有上传图片的产品列表 -->
|
|
<select id="getProKindList" parameterType="ProductImg"
|
|
resultType="ProductImg">
|
|
SELECT
|
|
id,
|
|
pro_type_value,
|
|
pro_type_label,
|
|
kind_value,
|
|
kind_label,
|
|
kind2_value,
|
|
kind2_label,
|
|
remark,
|
|
create_date
|
|
FROM
|
|
product_img
|
|
<where>
|
|
<if test="proTypeLabel != null and proTypeLabel !=''">
|
|
pro_type_label like "%${proTypeLabel}%"
|
|
</if>
|
|
</where>
|
|
ORDER BY pro_type_value,kind_value
|
|
</select>
|
|
|
|
<update id="updateImgUploadRemark" parameterType="ProductImg">
|
|
update product_img
|
|
set remark = #{remark}
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!--根据value获取label -->
|
|
<select id="getLabel" parameterType="ProductImg"
|
|
resultType="SysDictProduct">
|
|
SELECT DISTINCT pro_type_label,kind_label,kind2_label FROM
|
|
sys_dict_product
|
|
<where>
|
|
<if test="proTypeValue != null and proTypeValue != ''">
|
|
and pro_type_value = #{proTypeValue}
|
|
</if>
|
|
<if test="kindValue != null and kindValue != ''">
|
|
and kind_value = #{kindValue}
|
|
</if>
|
|
<if test="kind2Value != null and kind2Value != ''">
|
|
and kind2_value = #{kind2Value}
|
|
</if>
|
|
</where>
|
|
LIMIT 1
|
|
</select>
|
|
|
|
|
|
<!--新增图片信息 -->
|
|
<insert id="addImgUrl" useGeneratedKeys="true" keyProperty="id"
|
|
parameterType="ProductImg">
|
|
insert into product_img
|
|
(
|
|
pro_type_value,pro_type_label,
|
|
<if test="kindValue != null and kindValue !=''">
|
|
kind_value,
|
|
</if>
|
|
<if test="kindLabel != null and kindLabel !=''">
|
|
kind_label,
|
|
</if>
|
|
<if test="kind2Value != null and kind2Value !=''">
|
|
kind2_value,
|
|
</if>
|
|
<if test="kind2Label != null and kind2Label !=''">
|
|
kind2_label,
|
|
</if>
|
|
img_url,
|
|
remark,
|
|
filename
|
|
)
|
|
values
|
|
(
|
|
#{proTypeValue},#{proTypeLabel},
|
|
<if test="kindValue != null and kindValue !=''">
|
|
#{kindValue},
|
|
</if>
|
|
<if test="kindLabel != null and kindLabel !=''">
|
|
#{kindLabel},
|
|
</if>
|
|
<if test="kind2Value != null and kind2Value !=''">
|
|
#{kind2Value},
|
|
</if>
|
|
<if test="kind2Label != null and kind2Label !=''">
|
|
#{kind2Label},
|
|
</if>
|
|
#{imgUrl},
|
|
#{remark},
|
|
#{filename}
|
|
)
|
|
</insert>
|
|
|
|
|
|
<!-- 获取所有的产品 -->
|
|
<select id="findAllPro" resultType="SysDictProduct">
|
|
SELECT DISTINCT pro_type_label,
|
|
pro_type_value
|
|
FROM sys_dict_product
|
|
WHERE pro_type_label IS NOT NULL
|
|
</select>
|
|
|
|
<!--根据种类获取材质-->
|
|
<select id="getKindsByPro" resultType="SysDictProduct">
|
|
SELECT distinct kind_value,
|
|
kind_label
|
|
FROM sys_dict_product
|
|
WHERE pro_type_value = #{proTypeValue}
|
|
</select>
|
|
<!--根据材质获取规格-->
|
|
<select id="getKind2sByKind" resultType="SysDictProduct">
|
|
SELECT distinct
|
|
kind2_value,
|
|
kind2_label
|
|
FROM
|
|
sys_dict_product
|
|
<where>
|
|
<if test="proTypeValue != null and proTypeValue != ''">
|
|
and pro_type_value = #{proTypeValue}
|
|
</if>
|
|
<if test="kindValue != null and kindValue != ''">
|
|
and kind_value = #{kindValue}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!--轮播图/回显 根据条件获取产品图片-->
|
|
<select id="getImgsByProKind" parameterType="Product" resultType="ProductImg">
|
|
select id,img_url,remark,filename,img_width,img_height
|
|
from product_img
|
|
<where>
|
|
<if test="proTypeValue != null and proTypeValue != '' ">
|
|
and pro_type_value = #{proTypeValue}
|
|
</if>
|
|
<if test="kindValue != null and kindValue != '' ">
|
|
and kind_value = #{kindValue}
|
|
</if>
|
|
<if test="kind2Value != null and kind2Value != '' ">
|
|
and kind2_value = #{kind2Value}
|
|
</if>
|
|
<if test="craftValue != null and craftValue != '' ">
|
|
and craft_value = #{craftValue}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
</mapper> |