浏览代码

return entity

梁彦春 6 年前
父节点
当前提交
514e18c9cf

+ 4
- 1
src/main/java/com.huiju.welcome/controller/TaCustomerTransferController.java 查看文件

17
 import org.springframework.web.bind.annotation.ResponseBody;
17
 import org.springframework.web.bind.annotation.ResponseBody;
18
 import org.springframework.web.bind.annotation.RestController;
18
 import org.springframework.web.bind.annotation.RestController;
19
 
19
 
20
+import java.time.LocalDateTime;
21
+
20
 
22
 
21
 /**
23
 /**
22
  * <p>
24
  * <p>
47
     public ResponseBean tpShopImgAdd(@RequestBody TaCustomerTransfer taCustomerTransfer){
49
     public ResponseBean tpShopImgAdd(@RequestBody TaCustomerTransfer taCustomerTransfer){
48
         ResponseBean responseBean = new ResponseBean();
50
         ResponseBean responseBean = new ResponseBean();
49
         try {
51
         try {
52
+            taCustomerTransfer.setTransferTime(LocalDateTime.now());
50
             Boolean flag = iTaCustomerTransferService.save(taCustomerTransfer);
53
             Boolean flag = iTaCustomerTransferService.save(taCustomerTransfer);
51
             Boolean flagUpdate = false;
54
             Boolean flagUpdate = false;
52
             TaCustomer taCustomer = iTaCustomerService.getById(taCustomerTransfer.getCustomerId());
55
             TaCustomer taCustomer = iTaCustomerService.getById(taCustomerTransfer.getCustomerId());
54
             taCustomer.setRealtyConsultant(taCustomerTransfer.getToUserName());
57
             taCustomer.setRealtyConsultant(taCustomerTransfer.getToUserName());
55
             flagUpdate = iTaCustomerService.updateById(taCustomer);
58
             flagUpdate = iTaCustomerService.updateById(taCustomer);
56
             if (flag&&flagUpdate){
59
             if (flag&&flagUpdate){
57
-                responseBean.addSuccess("success");
60
+                responseBean.addSuccess(taCustomerTransfer);
58
             }else {
61
             }else {
59
                 responseBean.addError("fail");
62
                 responseBean.addError("fail");
60
             }
63
             }

+ 4
- 0
src/main/java/com.huiju.welcome/controller/TaGoodsController.java 查看文件

15
 import com.huiju.welcome.service.ITaGoodsImgService;
15
 import com.huiju.welcome.service.ITaGoodsImgService;
16
 import com.huiju.welcome.service.ITaGoodsService;
16
 import com.huiju.welcome.service.ITaGoodsService;
17
 import com.huiju.welcome.service.ITaGoodsSpecService;
17
 import com.huiju.welcome.service.ITaGoodsSpecService;
18
+import com.huiju.welcome.utils.StatusUtils;
18
 import io.swagger.annotations.ApiImplicitParam;
19
 import io.swagger.annotations.ApiImplicitParam;
19
 import io.swagger.annotations.ApiImplicitParams;
20
 import io.swagger.annotations.ApiImplicitParams;
20
 import io.swagger.annotations.ApiOperation;
21
 import io.swagger.annotations.ApiOperation;
23
 import org.springframework.beans.factory.annotation.Autowired;
24
 import org.springframework.beans.factory.annotation.Autowired;
24
 import org.springframework.web.bind.annotation.*;
25
 import org.springframework.web.bind.annotation.*;
25
 
26
 
27
+import java.time.LocalDateTime;
26
 import java.util.List;
28
 import java.util.List;
27
 
29
 
28
 
30
 
63
 
65
 
64
         ResponseBean responseBean = new ResponseBean();
66
         ResponseBean responseBean = new ResponseBean();
65
         try {
67
         try {
68
+            taGoods.setCreateDate(LocalDateTime.now());
69
+            taGoods.setStatus(StatusUtils.Normal);
66
             Boolean flag = iTaGoodsService.save(taGoods);
70
             Boolean flag = iTaGoodsService.save(taGoods);
67
             Boolean flagImg = iTaGoodsImgService.save(taGoodsImg);
71
             Boolean flagImg = iTaGoodsImgService.save(taGoodsImg);
68
             List<TaGoodsSpec> specList = spec.toJavaList(TaGoodsSpec.class);
72
             List<TaGoodsSpec> specList = spec.toJavaList(TaGoodsSpec.class);

+ 13
- 6
src/main/java/com.huiju.welcome/controller/TaGoodsOrdersController.java 查看文件

8
 import com.huiju.welcome.model.TaGoodsOrdersDetail;
8
 import com.huiju.welcome.model.TaGoodsOrdersDetail;
9
 import com.huiju.welcome.service.ITaGoodsOrdersDetailService;
9
 import com.huiju.welcome.service.ITaGoodsOrdersDetailService;
10
 import com.huiju.welcome.service.ITaGoodsOrdersService;
10
 import com.huiju.welcome.service.ITaGoodsOrdersService;
11
+import com.huiju.welcome.utils.StatusUtils;
11
 import com.huiju.welcome.utils.StringUtils;
12
 import com.huiju.welcome.utils.StringUtils;
12
 import org.slf4j.Logger;
13
 import org.slf4j.Logger;
13
 import org.slf4j.LoggerFactory;
14
 import org.slf4j.LoggerFactory;
19
 import org.springframework.web.bind.annotation.ResponseBody;
20
 import org.springframework.web.bind.annotation.ResponseBody;
20
 import org.springframework.web.bind.annotation.RestController;
21
 import org.springframework.web.bind.annotation.RestController;
21
 
22
 
23
+import java.time.LocalDateTime;
24
+import java.util.List;
25
+
22
 
26
 
23
 /**
27
 /**
24
  * <p>
28
  * <p>
52
         TaGoodsOrders taGoodsOrders =  jsonObject.getObject("goodsOrder", TaGoodsOrders.class);
56
         TaGoodsOrders taGoodsOrders =  jsonObject.getObject("goodsOrder", TaGoodsOrders.class);
53
         JSONArray detail = jsonObject.getJSONArray("detail");
57
         JSONArray detail = jsonObject.getJSONArray("detail");
54
         try {
58
         try {
59
+            taGoodsOrders.setCreateDate(LocalDateTime.now());
60
+            taGoodsOrders.setStatus(StatusUtils.Normal);
55
             Boolean flag = iTaGoodsOrdersService.save(taGoodsOrders);
61
             Boolean flag = iTaGoodsOrdersService.save(taGoodsOrders);
56
 
62
 
57
             Boolean flagDetail = false;
63
             Boolean flagDetail = false;
58
-            for(int i=0;i<detail.size();i++){
59
-                TaGoodsOrdersDetail taGoodsOrdersDetail = detail.getObject(i,TaGoodsOrdersDetail.class);
60
-                taGoodsOrdersDetail.setOrdersId(taGoodsOrders.getOrdersId());
61
-                flagDetail = iTaGoodsOrdersDetailService.save(taGoodsOrdersDetail);
62
-            }
64
+            List<TaGoodsOrdersDetail> detailList = detail.toJavaList(TaGoodsOrdersDetail.class);
65
+            detailList.stream().forEach(e -> {
66
+                e.setOrdersId(taGoodsOrders.getOrdersId());
67
+                e.setCreateDate(LocalDateTime.now());
68
+            });
69
+            flagDetail = iTaGoodsOrdersDetailService.saveBatch(detailList);
63
             if (flag&&flagDetail){
70
             if (flag&&flagDetail){
64
-                responseBean.addSuccess("success");
71
+                responseBean.addSuccess(taGoodsOrders);
65
             }else {
72
             }else {
66
                 responseBean.addError("fail");
73
                 responseBean.addError("fail");
67
             }
74
             }

+ 5
- 0
src/main/java/com.huiju.welcome/controller/TdGoodsTypeController.java 查看文件

8
 import com.huiju.welcome.model.SysUserRole;
8
 import com.huiju.welcome.model.SysUserRole;
9
 import com.huiju.welcome.model.TdGoodsType;
9
 import com.huiju.welcome.model.TdGoodsType;
10
 import com.huiju.welcome.service.ITdGoodsTypeService;
10
 import com.huiju.welcome.service.ITdGoodsTypeService;
11
+import com.huiju.welcome.utils.StatusUtils;
11
 import io.swagger.annotations.ApiImplicitParam;
12
 import io.swagger.annotations.ApiImplicitParam;
12
 import io.swagger.annotations.ApiImplicitParams;
13
 import io.swagger.annotations.ApiImplicitParams;
13
 import io.swagger.annotations.ApiOperation;
14
 import io.swagger.annotations.ApiOperation;
16
 import org.springframework.beans.factory.annotation.Autowired;
17
 import org.springframework.beans.factory.annotation.Autowired;
17
 import org.springframework.web.bind.annotation.*;
18
 import org.springframework.web.bind.annotation.*;
18
 
19
 
20
+import java.time.LocalDateTime;
21
+
19
 
22
 
20
 /**
23
 /**
21
  * <p>
24
  * <p>
44
     public ResponseBean tpShopImgAdd(@RequestBody TdGoodsType tdGoodsType){
47
     public ResponseBean tpShopImgAdd(@RequestBody TdGoodsType tdGoodsType){
45
         ResponseBean responseBean = new ResponseBean();
48
         ResponseBean responseBean = new ResponseBean();
46
         try {
49
         try {
50
+            tdGoodsType.setCreateTime(LocalDateTime.now());
51
+            tdGoodsType.setStatus(StatusUtils.Normal);
47
             if (iTdGoodsTypeService.save(tdGoodsType)){
52
             if (iTdGoodsTypeService.save(tdGoodsType)){
48
                 responseBean.addSuccess(tdGoodsType);
53
                 responseBean.addSuccess(tdGoodsType);
49
             }else {
54
             }else {

+ 3
- 2
src/main/resources/mapper/TaGoodsMapper.xml 查看文件

10
         left join ta_goods_img i on g.goods_id = i.goods_id
10
         left join ta_goods_img i on g.goods_id = i.goods_id
11
         left join td_goods_type t on g.type_id = t.type_id
11
         left join td_goods_type t on g.type_id = t.type_id
12
         <where>
12
         <where>
13
+            g.status > 0
13
             <if test="goodsName !=null and goodsName !=''">
14
             <if test="goodsName !=null and goodsName !=''">
14
-                g.goods_name LIKE CONCAT('%',#{goodsName},'%')
15
+                and g.goods_name LIKE CONCAT('%',#{goodsName},'%')
15
             </if>
16
             </if>
16
             <if test="typeId !=null and typeId !=''">
17
             <if test="typeId !=null and typeId !=''">
17
-                g.type_id = CONCAT('%',#{typeId},'%')
18
+                and g.type_id = CONCAT('%',#{typeId},'%')
18
             </if>
19
             </if>
19
         </where>
20
         </where>
20
     </select>
21
     </select>

+ 2
- 1
src/main/resources/mapper/TdGoodsTypeMapper.xml 查看文件

6
         *
6
         *
7
         from td_goods_type
7
         from td_goods_type
8
         <where>
8
         <where>
9
+            status > 0
9
             <if test="typeName !=null and typeName !=''">
10
             <if test="typeName !=null and typeName !=''">
10
-                type_name LIKE CONCAT('%',#{typeName},'%')
11
+               and type_name LIKE CONCAT('%',#{typeName},'%')
11
             </if>
12
             </if>
12
         </where>
13
         </where>
13
     </select>
14
     </select>

+ 2
- 1
src/main/resources/mapper/TdSpecMapper.xml 查看文件

6
         *
6
         *
7
         from td_spec
7
         from td_spec
8
         <where>
8
         <where>
9
+            status > 0
9
             <if test="specName !=null and specName !=''">
10
             <if test="specName !=null and specName !=''">
10
-                spec_name LIKE CONCAT('%',#{specName},'%')
11
+                and spec_name LIKE CONCAT('%',#{specName},'%')
11
             </if>
12
             </if>
12
         </where>
13
         </where>
13
     </select>
14
     </select>