|
@@ -0,0 +1,145 @@
|
|
|
+package com.pj.project.relation_goods_type;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import com.pj.utils.so.SoMap;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import com.pj.utils.sg.*;
|
|
|
+import com.pj.project4sp.SP;
|
|
|
+
|
|
|
+import com.pj.current.satoken.StpUserUtil;
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * Controller: relation_goods_type -- 业务类型与作业项
|
|
|
+ * @author qzy
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/RelationGoodsType/")
|
|
|
+public class RelationGoodsTypeController {
|
|
|
+
|
|
|
+ /** 底层 Service 对象 */
|
|
|
+ @Autowired
|
|
|
+ RelationGoodsTypeService relationGoodsTypeService;
|
|
|
+
|
|
|
+ /** 增 */
|
|
|
+ @RequestMapping("add")
|
|
|
+ @SaCheckPermission(RelationGoodsType.PERMISSION_CODE)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public AjaxJson add(RelationGoodsType r){
|
|
|
+ relationGoodsTypeService.add(r);
|
|
|
+ r = relationGoodsTypeService.getById(SP.publicMapper.getPrimarykey());
|
|
|
+ return AjaxJson.getSuccessData(r);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 删 */
|
|
|
+ @RequestMapping("delete")
|
|
|
+ @SaCheckPermission(RelationGoodsType.PERMISSION_CODE)
|
|
|
+ public AjaxJson delete(Long id){
|
|
|
+ int line = relationGoodsTypeService.delete(id);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 删 - 根据id列表 */
|
|
|
+ @RequestMapping("deleteByIds")
|
|
|
+ @SaCheckPermission(RelationGoodsType.PERMISSION_CODE)
|
|
|
+ public AjaxJson deleteByIds(){
|
|
|
+ List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
|
|
|
+ int line = SP.publicMapper.deleteByIds(RelationGoodsType.TABLE_NAME, ids);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 改 */
|
|
|
+ @RequestMapping("update")
|
|
|
+ @SaCheckPermission(RelationGoodsType.PERMISSION_CODE)
|
|
|
+ public AjaxJson update(RelationGoodsType r){
|
|
|
+ int line = relationGoodsTypeService.update(r);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 查 - 根据id */
|
|
|
+ @RequestMapping("getById")
|
|
|
+ public AjaxJson getById(Long id){
|
|
|
+ RelationGoodsType r = relationGoodsTypeService.getById(id);
|
|
|
+ return AjaxJson.getSuccessData(r);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
|
|
|
+ @RequestMapping("getList")
|
|
|
+ public AjaxJson getList() {
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
+ List<RelationGoodsType> list = relationGoodsTypeService.getList(so.startPage());
|
|
|
+ return AjaxJson.getPageData(so.getDataCount(), list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /** 改 - 载重是否必填(1=是,0=否) */
|
|
|
+ @RequestMapping("updateNeedWeight")
|
|
|
+ @SaCheckPermission(RelationGoodsType.PERMISSION_CODE)
|
|
|
+ public AjaxJson updateNeedWeight(Long id, String value){
|
|
|
+ int line = SP.publicMapper.updateColumnById(RelationGoodsType.TABLE_NAME, "need_weight", value, id);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 改 - 规格是否必填(1=是,0=否) */
|
|
|
+ @RequestMapping("updateNeedCarSize")
|
|
|
+ @SaCheckPermission(RelationGoodsType.PERMISSION_CODE)
|
|
|
+ public AjaxJson updateNeedCarSize(Long id, String value){
|
|
|
+ int line = SP.publicMapper.updateColumnById(RelationGoodsType.TABLE_NAME, "need_car_size", value, id);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 改 - 申报单是否必填(1=是,0=否) */
|
|
|
+ @RequestMapping("updateNeedDeclare")
|
|
|
+ @SaCheckPermission(RelationGoodsType.PERMISSION_CODE)
|
|
|
+ public AjaxJson updateNeedDeclare(Long id, String value){
|
|
|
+ int line = SP.publicMapper.updateColumnById(RelationGoodsType.TABLE_NAME, "need_declare", value, id);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 改 - 申报时间是否必填(1=是,0=否) */
|
|
|
+ @RequestMapping("updateNeedOperateTime")
|
|
|
+ @SaCheckPermission(RelationGoodsType.PERMISSION_CODE)
|
|
|
+ public AjaxJson updateNeedOperateTime(Long id, String value){
|
|
|
+ int line = SP.publicMapper.updateColumnById(RelationGoodsType.TABLE_NAME, "need_operate_time", value, id);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 改 - 是否必选(1=是,0=否) */
|
|
|
+ @RequestMapping("updateNeedSelect")
|
|
|
+ @SaCheckPermission(RelationGoodsType.PERMISSION_CODE)
|
|
|
+ public AjaxJson updateNeedSelect(Long id, Integer value){
|
|
|
+ int line = SP.publicMapper.updateColumnById(RelationGoodsType.TABLE_NAME, "need_select", value, id);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // ------------------------- 前端接口 -------------------------
|
|
|
+
|
|
|
+
|
|
|
+ /** 改 - 不传不改 [G] */
|
|
|
+ @RequestMapping("updateByNotNull")
|
|
|
+ public AjaxJson updateByNotNull(Long id){
|
|
|
+ AjaxError.throwBy(true, "如需正常调用此接口,请删除此行代码");
|
|
|
+ // 鉴别身份,是否为数据创建者
|
|
|
+ long userId = SP.publicMapper.getColumnByIdToLong(RelationGoodsType.TABLE_NAME, "user_id", id);
|
|
|
+ AjaxError.throwBy(userId != StpUserUtil.getLoginIdAsLong(), "此数据您无权限修改");
|
|
|
+ // 开始修改 (请只保留需要修改的字段)
|
|
|
+ SoMap so = SoMap.getRequestSoMap();
|
|
|
+ so.clearNotIn("id", "goodsId", "goodsName", "typeId", "typeName", "needWeight", "needCarSize", "needDeclare", "needOperateTime", "needSelect").clearNull().humpToLineCase();
|
|
|
+ int line = SP.publicMapper.updateBySoMapById(RelationGoodsType.TABLE_NAME, so, id);
|
|
|
+ return AjaxJson.getByLine(line);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|