条件查询goods列表
This commit is contained in:
parent
8dfb3f0002
commit
d819f4fb0c
|
|
@ -46,7 +46,7 @@ public class GoodsController extends BaseController {
|
||||||
// @RequiresPermissions("goods:goods:list")
|
// @RequiresPermissions("goods:goods:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo list(Goods goods) {
|
public TableDataInfo list(@RequestBody Goods goods) {
|
||||||
startPage();
|
startPage();
|
||||||
List<Goods> list = goodsService.selectGoodsList(goods);
|
List<Goods> list = goodsService.selectGoodsList(goods);
|
||||||
list.forEach(one->{
|
list.forEach(one->{
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,9 @@ public class Goods extends BaseEntity {
|
||||||
@Excel(name = "状态", readConverterExp = "0=上架,1=下架,2删除")
|
@Excel(name = "状态", readConverterExp = "0=上架,1=下架,2删除")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
@Excel(name = "区域Id", cellType = Excel.ColumnType.NUMERIC)
|
||||||
|
private Long areaId;
|
||||||
|
|
||||||
private List<GoodsArea> goodsAreaList;
|
private List<GoodsArea> goodsAreaList;
|
||||||
|
|
||||||
private Map<Integer, List<GoodsImgs>> goodsImgsMap;
|
private Map<Integer, List<GoodsImgs>> goodsImgsMap;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,12 @@
|
||||||
dept_goods_category_id, goods_img_url, goods_video_url, status, create_by, create_time, remark
|
dept_goods_category_id, goods_img_url, goods_video_url, status, create_by, create_time, remark
|
||||||
FROM goods
|
FROM goods
|
||||||
</sql>
|
</sql>
|
||||||
|
<sql id="selectGoodsWithArea">
|
||||||
|
SELECT DISTINCT g.goods_id, goods_code, dept_id, goods_name, goods_sort, worker_id,
|
||||||
|
dept_goods_category_id, goods_img_url, goods_video_url, status, create_by, create_time, remark
|
||||||
|
FROM goods g
|
||||||
|
LEFT JOIN goods_area ga ON g.goods_id = ga.goods_id
|
||||||
|
</sql>
|
||||||
|
|
||||||
<update id="updateGoods" parameterType="com.ghy.goods.domain.Goods">
|
<update id="updateGoods" parameterType="com.ghy.goods.domain.Goods">
|
||||||
UPDATE goods
|
UPDATE goods
|
||||||
|
|
@ -80,7 +86,7 @@
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="selectGoodsList" parameterType="com.ghy.goods.domain.Goods" resultMap="GoodsResult">
|
<select id="selectGoodsList" parameterType="com.ghy.goods.domain.Goods" resultMap="GoodsResult">
|
||||||
<include refid="selectGoods" />
|
<include refid="selectGoodsWithArea" />
|
||||||
<where>
|
<where>
|
||||||
<if test="goodsCode != null and goodsCode != ''">
|
<if test="goodsCode != null and goodsCode != ''">
|
||||||
AND goods_code like concat('%', #{goodsCode}, '%')
|
AND goods_code like concat('%', #{goodsCode}, '%')
|
||||||
|
|
@ -88,7 +94,20 @@
|
||||||
<if test="deptGoodsCategoryId != null and deptGoodsCategoryId != ''">
|
<if test="deptGoodsCategoryId != null and deptGoodsCategoryId != ''">
|
||||||
AND dept_goods_category_id = #{deptGoodsCategoryId}
|
AND dept_goods_category_id = #{deptGoodsCategoryId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="areaId != null and areaId != ''">
|
||||||
|
AND country_area_id = #{areaId}
|
||||||
|
</if>
|
||||||
|
<if test="goodsName != null and goodsName != ''">
|
||||||
|
AND goods_name like concat('%', #{goodsName}, '%')
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
/* 默认生成时间排序 */
|
||||||
|
order by create_time
|
||||||
|
<trim suffixOverrides=",">
|
||||||
|
<if test="params.createTimeSort != null and params.createTimeSort != ''">
|
||||||
|
${params.createTimeSort}
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectById" parameterType="long" resultMap="GoodsResult">
|
<select id="selectById" parameterType="long" resultMap="GoodsResult">
|
||||||
|
|
@ -137,4 +156,4 @@
|
||||||
#{ids}
|
#{ids}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue