Browse Source

资源详情处理

master
xyiege 4 years ago
parent
commit
a94765c9f7
  1. 16
      src/main/java/cn/chjyj/szwh/controller/admin/AdminGoodsController.java
  2. 12
      src/main/java/cn/chjyj/szwh/mapper/GoodsSourceMapper.java
  3. 20
      src/main/resources/mapper/szwh/GoodsSourceMapper.xml
  4. 10
      src/test/java/cn/chjyj/szwh/mapper/GoodsSourceMapperTest.java

16
src/main/java/cn/chjyj/szwh/controller/admin/AdminGoodsController.java

@ -2,11 +2,13 @@ package cn.chjyj.szwh.controller.admin;
import cn.chjyj.szwh.bean.Goods;
import cn.chjyj.szwh.bean.GoodsDetail;
import cn.chjyj.szwh.bean.GoodsSource;
import cn.chjyj.szwh.bean.User;
import cn.chjyj.szwh.controller.BaseController;
import cn.chjyj.szwh.exception.ChException;
import cn.chjyj.szwh.service.GoodsDetailService;
import cn.chjyj.szwh.service.GoodsService;
import cn.chjyj.szwh.service.GoodsSourceService;
import cn.chjyj.szwh.service.UserService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@ -28,6 +30,8 @@ public class AdminGoodsController extends BaseController {
@Autowired
private GoodsDetailService goodsDetailService;
@Autowired
private GoodsSourceService goodsSourceService;
@Autowired
private UserService userService;
/**
@ -193,8 +197,18 @@ public class AdminGoodsController extends BaseController {
* @param jstr vue端发送来的json字符串
* @return
*/
@PostMapping("/sourceDetail")
@RequestMapping("/sourceDetail")
public JSONObject sourceDetail(@RequestBody String jstr){
JSONObject request = JSON.parseObject(jstr);
String isli=request.getString("isli");
String islicode=request.getString("islicode");
String batchcode = request.getString("batchcode");
Map<String,Object> gsmap = goodsSourceService.getGoodsSourceDetail(isli,islicode,batchcode);
jsonObject.put("code",200);
jsonObject.put("msg","成功");
jsonObject.put("data",gsmap);
return jsonObject;
}
}

12
src/main/java/cn/chjyj/szwh/mapper/GoodsSourceMapper.java

@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* 商品来源
@ -27,4 +28,15 @@ public interface GoodsSourceMapper {
*/
int countGoodSource(@Param("goodsIsli") String goodsIsli,@Param("dataype") int type,
@Param("sourceIdentify")String sourceIdentify);
/**
* 条件检索GOODSSOURCE
* @param map
* @param start
* @param limit
* @return
*/
List<GoodsSource> getGoodsSourceByMap(@Param("map") Map map,
@Param("start") int start,
@Param("limit") int limit);
}

20
src/main/resources/mapper/szwh/GoodsSourceMapper.xml

@ -33,11 +33,23 @@
AND sourceIdentify like concat("%",#{sourceIdentify},"%");
</select>
<!--查询用户名,加上密码-->
<select id="getUserByUname" parameterType="java.lang.String" resultType="cn.chjyj.szwh.bean.Goods">
select <include refid="column"/>,password
<!-- 条件检索GOODSSOURCE -->
<select id="getGoodsSourceByMap" parameterType="java.lang.String" resultType="cn.chjyj.szwh.bean.GoodsSource">
select <include refid="column"/>
from <include refid="tbName"/>
where uname=#{uname} limit 1;
<where>
<if test="map!=null">
<foreach collection="map" item="v" index="k" separator="and">
<if test="v != null and v != '' and k!='sourceIdentify'">
${k} = #{v}
</if>
<if test="k=='sourceIdentify'">
sourceIdentify like concat ('%',#{v},'%')
</if>
</foreach>
</if>
</where>
limit #{start},#{limit}
</select>
<!--查询用户-->

10
src/test/java/cn/chjyj/szwh/mapper/GoodsSourceMapperTest.java

@ -9,7 +9,9 @@ import org.springframework.test.context.junit4.SpringRunner;
import javax.xml.ws.soap.Addressing;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.*;
@ -40,4 +42,12 @@ class GoodsSourceMapperTest {
int cc = goodsSourceMapper.countGoodSource(gisl,1,"ISLI01");
System.out.println(cc);
}
@Test
public void getGoodsSourceByMap(){
Map map =new HashMap();
map.put("sourceIdentify","010005-000000000000013279999999-7");
List<GoodsSource> goodsSource = goodsSourceMapper.getGoodsSourceByMap(map,0,10);
System.out.println(goodsSource.size());
}
}
Loading…
Cancel
Save