@@ -32,7 +32,7 @@ public class AppTbGoodsController {
}
- /** 查 - 根据id */
+ /** 查 - 根据id */
@RequestMapping("getById")
// @SaCheckPermission(TbGoods.PERMISSION_CODE)
public AjaxJson getById(String id){
@@ -40,12 +40,12 @@ public class AppTbGoodsController {
return AjaxJson.getSuccessData(t);
- /** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
- @RequestMapping("getList")
+ /** 查集合 - 根据互市区Id */
+ @RequestMapping("getByTradeArea")
- public AjaxJson getList() {
+ public AjaxJson getByTradeArea() {
SoMap so = SoMap.getRequestSoMap();
- List<TbGoods> list = tbGoodsService.getList(so.startPage());
+ List<TbGoods> list = tbGoodsService.getByTradeArea(so.startPage());
return AjaxJson.getPageData(so.getDataCount(), list);
@@ -10,7 +10,7 @@ import org.springframework.stereotype.Repository;
/**
* Mapper: tb_goods -- 商品
- * @author qzy
+ * @author qzy
*/
@Mapper
@@ -21,10 +21,17 @@ public interface TbGoodsMapper extends BaseMapper <TbGoods> {
* 查集合 - 根据条件(参数为空时代表忽略指定条件)
- * @param so 参数集合
- * @return 数据列表
+ * @param so 参数集合
+ * @return 数据列表
List<TbGoods> getList(SoMap so);
+ /**
+ * 查集合 - 根据互市区Id
+ */
+ List<TbGoods> getByTradeArea(SoMap so);
+
@@ -7,17 +7,17 @@
<!-- ================================== 查询相关 ================================== -->
<!-- select id, name, avatar, type_ids, type_names, code, remark, source, status, create_time, unit, single_price, tax_no from tb_goods -->
-
<!-- 通用映射:自动模式 -->
<resultMap id="model" autoMapping="true" type="com.pj.tb_goods.TbGoods"></resultMap>
<!-- 公共查询sql片段 -->
<sql id="select_sql">
- select *
- from tb_goods
+ select *
+ from tb_goods
</sql>
<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
<select id="getList" resultMap="model">
<include refid="select_sql"></include>
@@ -52,14 +52,21 @@
<otherwise> id desc </otherwise>
</choose>
</select>
+ <!-- 查集合 - 根据互市区Id -->
+ <select id="getByTradeArea" resultMap="model">
+ select g.* from tb_goods g
+ left join re_trade_area_goods ta on g.id = ta.goods_id
+ where ta.area_id = #{tradeAreaId}
+ </select>
</mapper>
@@ -27,7 +27,7 @@ import javax.swing.filechooser.FileSystemView;
* Service: tb_goods -- 商品
@Service
@Transactional(rollbackFor = Exception.class)
@@ -62,9 +62,14 @@ public class TbGoodsService extends ServiceImpl<TbGoodsMapper, TbGoods> implemen
return super.getById(id);
- List<TbGoods> getList(SoMap so) {
- return tbGoodsMapper.getList(so);
+ /** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
+ List<TbGoods> getList(SoMap so) {
+ return tbGoodsMapper.getList(so);
+ }
+ List<TbGoods> getByTradeArea(SoMap so) {
+ return tbGoodsMapper.getByTradeArea(so);