From 1eaa7387085a2bc0f434ba46eb2d61991d42cd3e Mon Sep 17 00:00:00 2001 From: zhanghl <253316343@qq.com> Date: 星期二, 15 四月 2025 11:51:06 +0800 Subject: [PATCH] 工厂 车间管理 --- aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsShop.java | 101 ++++++++++ aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlantServiceImpl.java | 10 aps-common/aps-common-core/src/main/java/com/aps/common/core/utils/uuid/IdUtils.java | 24 ++ aps-modules/aps-core/src/main/java/com/aps/core/service/IApsShopService.java | 61 ++++++ aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsPlantController.java | 16 aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsShopMapper.java | 63 ++++++ aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsShopServiceImpl.java | 100 ++++++++++ aps-modules/aps-core/src/main/resources/mapper/core/ApsPlantMapper.xml | 6 aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsShopController.java | 98 +++++++++ aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlantService.java | 6 aps-modules/aps-core/src/main/resources/mapper/core/ApsShopMapper.xml | 89 ++++++++ aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlantMapper.java | 6 12 files changed, 561 insertions(+), 19 deletions(-) diff --git a/aps-common/aps-common-core/src/main/java/com/aps/common/core/utils/uuid/IdUtils.java b/aps-common/aps-common-core/src/main/java/com/aps/common/core/utils/uuid/IdUtils.java index 892afff..bbaf496 100644 --- a/aps-common/aps-common-core/src/main/java/com/aps/common/core/utils/uuid/IdUtils.java +++ b/aps-common/aps-common-core/src/main/java/com/aps/common/core/utils/uuid/IdUtils.java @@ -1,5 +1,9 @@ package com.aps.common.core.utils.uuid; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.concurrent.atomic.AtomicLong; + /** * ID鐢熸垚鍣ㄥ伐鍏风被 * @@ -46,4 +50,24 @@ { return UUID.fastUUID().toString(true); } + + private static AtomicLong id; + /** + * 鐢熸垚Long 绫诲瀷鍞竴ID + */ + public synchronized static Long getId() { + //濡傛灉闇�瑕佹洿闀� 鎴栬�呮洿澶у啑浣欑┖闂�, 鍙渶瑕� time * 10^n 鍗冲彲 + //褰撳墠鍙繚璇�1姣 鐢熸垚 10000鏉′笉閲嶅 + Long time = Long.valueOf(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()))*10000; + if (id == null) { + id = new AtomicLong(time); + return id.get(); + } + if (time <= id.get()) { + id.addAndGet(1); + } else { + id = new AtomicLong(time); + } + return id.get(); + } } diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsPlantController.java b/aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsPlantController.java index 89d3526..736f1b5 100644 --- a/aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsPlantController.java +++ b/aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsPlantController.java @@ -31,7 +31,7 @@ /** * 鏌ヨ宸ュ巶绠$悊鍒楄〃 */ - @RequiresPermissions("aps_plant:list") + @RequiresPermissions("plant:list") @GetMapping("/list") public TableDataInfo list(ApsPlant apsPlant) { @@ -43,7 +43,7 @@ /** * 瀵煎嚭宸ュ巶绠$悊鍒楄〃 */ - @RequiresPermissions("aps_plant:export") + @RequiresPermissions("plant:export") @Log(title = "宸ュ巶绠$悊", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, ApsPlant apsPlant) @@ -56,9 +56,9 @@ /** * 鑾峰彇宸ュ巶绠$悊璇︾粏淇℃伅 */ - @RequiresPermissions("aps_plant:query") + @RequiresPermissions("plant:query") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) + public AjaxResult getInfo(@PathVariable("id") String id) { return success(apsPlantService.selectApsPlantById(id)); } @@ -66,7 +66,7 @@ /** * 鏂板宸ュ巶绠$悊 */ - @RequiresPermissions("aps_plant:add") + @RequiresPermissions("plant:add") @Log(title = "宸ュ巶绠$悊", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ApsPlant apsPlant) @@ -77,7 +77,7 @@ /** * 淇敼宸ュ巶绠$悊 */ - @RequiresPermissions("aps_plant:edit") + @RequiresPermissions("plant:edit") @Log(title = "宸ュ巶绠$悊", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody ApsPlant apsPlant) @@ -88,10 +88,10 @@ /** * 鍒犻櫎宸ュ巶绠$悊 */ - @RequiresPermissions("aps_plant:remove") + @RequiresPermissions("plant:remove") @Log(title = "宸ュ巶绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) + public AjaxResult remove(@PathVariable String[] ids) { return toAjax(apsPlantService.deleteApsPlantByIds(ids)); } diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsShopController.java b/aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsShopController.java new file mode 100644 index 0000000..48f08bf --- /dev/null +++ b/aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsShopController.java @@ -0,0 +1,98 @@ +package com.aps.core.controller.basicData; + +import com.aps.common.core.utils.poi.ExcelUtil; +import com.aps.common.core.web.controller.BaseController; +import com.aps.common.core.web.domain.AjaxResult; +import com.aps.common.core.web.page.TableDataInfo; +import com.aps.common.log.annotation.Log; +import com.aps.common.log.enums.BusinessType; +import com.aps.common.security.annotation.RequiresPermissions; +import com.aps.core.domain.ApsShop; +import com.aps.core.service.IApsShopService; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 杞﹂棿Controller + * + * @author ruoyi + * @date 2025-04-14 + */ +@RestController +@RequestMapping("/aps_shop") +public class ApsShopController extends BaseController +{ + @Autowired + private IApsShopService apsShopService; + + /** + * 鏌ヨ杞﹂棿鍒楄〃 + */ + @RequiresPermissions("shop:list") + @GetMapping("/list") + public TableDataInfo list(ApsShop apsShop) + { + startPage(); + List<ApsShop> list = apsShopService.selectApsShopList(apsShop); + return getDataTable(list); + } + + /** + * 瀵煎嚭杞﹂棿鍒楄〃 + */ + @RequiresPermissions("shop:export") + @Log(title = "杞﹂棿", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ApsShop apsShop) + { + List<ApsShop> list = apsShopService.selectApsShopList(apsShop); + ExcelUtil<ApsShop> util = new ExcelUtil<ApsShop>(ApsShop.class); + util.exportExcel(response, list, "杞﹂棿鏁版嵁"); + } + + /** + * 鑾峰彇杞﹂棿璇︾粏淇℃伅 + */ + @RequiresPermissions("shop:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) + { + return success(apsShopService.selectApsShopById(id)); + } + + /** + * 鏂板杞﹂棿 + */ + @RequiresPermissions("shop:add") + @Log(title = "杞﹂棿", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ApsShop apsShop) + { + return toAjax(apsShopService.insertApsShop(apsShop)); + } + + /** + * 淇敼杞﹂棿 + */ + @RequiresPermissions("shop:edit") + @Log(title = "杞﹂棿", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ApsShop apsShop) + { + return toAjax(apsShopService.updateApsShop(apsShop)); + } + + /** + * 鍒犻櫎杞﹂棿 + */ + @RequiresPermissions("shop:remove") + @Log(title = "杞﹂棿", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) + { + return toAjax(apsShopService.deleteApsShopByIds(ids)); + } +} diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsShop.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsShop.java new file mode 100644 index 0000000..984d4b0 --- /dev/null +++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsShop.java @@ -0,0 +1,101 @@ +package com.aps.core.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.aps.common.core.annotation.Excel; +import com.aps.common.core.web.domain.BaseEntity; + +/** + * 杞﹂棿瀵硅薄 aps_shop + * + * @author ruoyi + * @date 2025-04-14 + */ +public class ApsShop extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private String id; + + /** 杞﹂棿鍚嶇О */ + @Excel(name = "杞﹂棿鍚嶇О") + private String shopName; + + /** 杞﹂棿浠g爜 */ + @Excel(name = "杞﹂棿浠g爜") + private String shopCode; + + /** 宸ュ巶浠g爜 */ + @Excel(name = "宸ュ巶浠g爜") + private String plantCode; + + /** 鍚敤鐘舵�� */ + @Excel(name = "鍚敤鐘舵��") + private String status; + + public void setId(String id) + { + this.id = id; + } + + public String getId() + { + return id; + } + + public void setShopName(String shopName) + { + this.shopName = shopName; + } + + public String getShopName() + { + return shopName; + } + + public void setShopCode(String shopCode) + { + this.shopCode = shopCode; + } + + public String getShopCode() + { + return shopCode; + } + + public void setPlantCode(String plantCode) + { + this.plantCode = plantCode; + } + + public String getPlantCode() + { + return plantCode; + } + + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("shopName", getShopName()) + .append("shopCode", getShopCode()) + .append("plantCode", getPlantCode()) + .append("status", getStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlantMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlantMapper.java index 9171804..3103b2f 100644 --- a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlantMapper.java +++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlantMapper.java @@ -19,7 +19,7 @@ * @param id 宸ュ巶绠$悊涓婚敭 * @return 宸ュ巶绠$悊 */ - public ApsPlant selectApsPlantById(Long id); + public ApsPlant selectApsPlantById(String id); /** * 鏌ヨ宸ュ巶绠$悊鍒楄〃 @@ -51,7 +51,7 @@ * @param id 宸ュ巶绠$悊涓婚敭 * @return 缁撴灉 */ - public int deleteApsPlantById(Long id); + public int deleteApsPlantById(String id); /** * 鎵归噺鍒犻櫎宸ュ巶绠$悊 @@ -59,5 +59,5 @@ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎 * @return 缁撴灉 */ - public int deleteApsPlantByIds(Long[] ids); + public int deleteApsPlantByIds(String[] ids); } diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsShopMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsShopMapper.java new file mode 100644 index 0000000..491ee60 --- /dev/null +++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsShopMapper.java @@ -0,0 +1,63 @@ +package com.aps.core.mapper; + +import java.util.List; +import com.aps.core.domain.ApsShop; +import org.apache.ibatis.annotations.Mapper; + +/** + * 杞﹂棿Mapper鎺ュ彛 + * + * @author ruoyi + * @date 2025-04-14 + */ +@Mapper +public interface ApsShopMapper +{ + /** + * 鏌ヨ杞﹂棿 + * + * @param id 杞﹂棿涓婚敭 + * @return 杞﹂棿 + */ + public ApsShop selectApsShopById(String id); + + /** + * 鏌ヨ杞﹂棿鍒楄〃 + * + * @param apsShop 杞﹂棿 + * @return 杞﹂棿闆嗗悎 + */ + public List<ApsShop> selectApsShopList(ApsShop apsShop); + + /** + * 鏂板杞﹂棿 + * + * @param apsShop 杞﹂棿 + * @return 缁撴灉 + */ + public int insertApsShop(ApsShop apsShop); + + /** + * 淇敼杞﹂棿 + * + * @param apsShop 杞﹂棿 + * @return 缁撴灉 + */ + public int updateApsShop(ApsShop apsShop); + + /** + * 鍒犻櫎杞﹂棿 + * + * @param id 杞﹂棿涓婚敭 + * @return 缁撴灉 + */ + public int deleteApsShopById(String id); + + /** + * 鎵归噺鍒犻櫎杞﹂棿 + * + * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎 + * @return 缁撴灉 + */ + public int deleteApsShopByIds(String[] ids); +} diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlantService.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlantService.java index cb7daa3..bfcec65 100644 --- a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlantService.java +++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlantService.java @@ -17,7 +17,7 @@ * @param id 宸ュ巶绠$悊涓婚敭 * @return 宸ュ巶绠$悊 */ - public ApsPlant selectApsPlantById(Long id); + public ApsPlant selectApsPlantById(String id); /** * 鏌ヨ宸ュ巶绠$悊鍒楄〃 @@ -49,7 +49,7 @@ * @param ids 闇�瑕佸垹闄ょ殑宸ュ巶绠$悊涓婚敭闆嗗悎 * @return 缁撴灉 */ - public int deleteApsPlantByIds(Long[] ids); + public int deleteApsPlantByIds(String[] ids); /** * 鍒犻櫎宸ュ巶绠$悊淇℃伅 @@ -57,5 +57,5 @@ * @param id 宸ュ巶绠$悊涓婚敭 * @return 缁撴灉 */ - public int deleteApsPlantById(Long id); + public int deleteApsPlantById(String id); } diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsShopService.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsShopService.java new file mode 100644 index 0000000..118614e --- /dev/null +++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsShopService.java @@ -0,0 +1,61 @@ +package com.aps.core.service; + +import java.util.List; +import com.aps.core.domain.ApsShop; + +/** + * 杞﹂棿Service鎺ュ彛 + * + * @author ruoyi + * @date 2025-04-14 + */ +public interface IApsShopService +{ + /** + * 鏌ヨ杞﹂棿 + * + * @param id 杞﹂棿涓婚敭 + * @return 杞﹂棿 + */ + public ApsShop selectApsShopById(String id); + + /** + * 鏌ヨ杞﹂棿鍒楄〃 + * + * @param apsShop 杞﹂棿 + * @return 杞﹂棿闆嗗悎 + */ + public List<ApsShop> selectApsShopList(ApsShop apsShop); + + /** + * 鏂板杞﹂棿 + * + * @param apsShop 杞﹂棿 + * @return 缁撴灉 + */ + public int insertApsShop(ApsShop apsShop); + + /** + * 淇敼杞﹂棿 + * + * @param apsShop 杞﹂棿 + * @return 缁撴灉 + */ + public int updateApsShop(ApsShop apsShop); + + /** + * 鎵归噺鍒犻櫎杞﹂棿 + * + * @param ids 闇�瑕佸垹闄ょ殑杞﹂棿涓婚敭闆嗗悎 + * @return 缁撴灉 + */ + public int deleteApsShopByIds(String[] ids); + + /** + * 鍒犻櫎杞﹂棿淇℃伅 + * + * @param id 杞﹂棿涓婚敭 + * @return 缁撴灉 + */ + public int deleteApsShopById(String id); +} diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlantServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlantServiceImpl.java index 47a5aac..04520f7 100644 --- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlantServiceImpl.java +++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlantServiceImpl.java @@ -2,6 +2,8 @@ import java.util.List; import com.aps.common.core.utils.DateUtils; +import com.aps.common.core.utils.uuid.IdUtils; +import com.aps.common.security.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.aps.core.mapper.ApsPlantMapper; @@ -27,7 +29,7 @@ * @return 宸ュ巶绠$悊 */ @Override - public ApsPlant selectApsPlantById(Long id) + public ApsPlant selectApsPlantById(String id) { return apsPlantMapper.selectApsPlantById(id); } @@ -53,7 +55,9 @@ @Override public int insertApsPlant(ApsPlant apsPlant) { + apsPlant.setId(IdUtils.fastSimpleUUID()); apsPlant.setCreateTime(DateUtils.getNowDate()); + apsPlant.setCreateBy(SecurityUtils.getUsername()); return apsPlantMapper.insertApsPlant(apsPlant); } @@ -77,7 +81,7 @@ * @return 缁撴灉 */ @Override - public int deleteApsPlantByIds(Long[] ids) + public int deleteApsPlantByIds(String[] ids) { return apsPlantMapper.deleteApsPlantByIds(ids); } @@ -89,7 +93,7 @@ * @return 缁撴灉 */ @Override - public int deleteApsPlantById(Long id) + public int deleteApsPlantById(String id) { return apsPlantMapper.deleteApsPlantById(id); } diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsShopServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsShopServiceImpl.java new file mode 100644 index 0000000..a83b730 --- /dev/null +++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsShopServiceImpl.java @@ -0,0 +1,100 @@ +package com.aps.core.service.impl; + +import java.util.List; +import com.aps.common.core.utils.DateUtils; +import com.aps.common.core.utils.uuid.IdUtils; +import com.aps.common.security.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.aps.core.mapper.ApsShopMapper; +import com.aps.core.domain.ApsShop; +import com.aps.core.service.IApsShopService; + +/** + * 杞﹂棿Service涓氬姟灞傚鐞� + * + * @author ruoyi + * @date 2025-04-14 + */ +@Service +public class ApsShopServiceImpl implements IApsShopService +{ + @Autowired + private ApsShopMapper apsShopMapper; + + /** + * 鏌ヨ杞﹂棿 + * + * @param id 杞﹂棿涓婚敭 + * @return 杞﹂棿 + */ + @Override + public ApsShop selectApsShopById(String id) + { + return apsShopMapper.selectApsShopById(id); + } + + /** + * 鏌ヨ杞﹂棿鍒楄〃 + * + * @param apsShop 杞﹂棿 + * @return 杞﹂棿 + */ + @Override + public List<ApsShop> selectApsShopList(ApsShop apsShop) + { + return apsShopMapper.selectApsShopList(apsShop); + } + + /** + * 鏂板杞﹂棿 + * + * @param apsShop 杞﹂棿 + * @return 缁撴灉 + */ + @Override + public int insertApsShop(ApsShop apsShop) + { + apsShop.setId(IdUtils.fastSimpleUUID()); + apsShop.setCreateBy(SecurityUtils.getUsername()); + apsShop.setCreateTime(DateUtils.getNowDate()); + return apsShopMapper.insertApsShop(apsShop); + } + + /** + * 淇敼杞﹂棿 + * + * @param apsShop 杞﹂棿 + * @return 缁撴灉 + */ + @Override + public int updateApsShop(ApsShop apsShop) + { + apsShop.setUpdateTime(DateUtils.getNowDate()); + return apsShopMapper.updateApsShop(apsShop); + } + + /** + * 鎵归噺鍒犻櫎杞﹂棿 + * + * @param ids 闇�瑕佸垹闄ょ殑杞﹂棿涓婚敭 + * @return 缁撴灉 + */ + @Override + public int deleteApsShopByIds(String[] ids) + { + return apsShopMapper.deleteApsShopByIds(ids); + } + + /** + * 鍒犻櫎杞﹂棿淇℃伅 + * + * @param id 杞﹂棿涓婚敭 + * @return 缁撴灉 + */ + @Override + public int deleteApsShopById(String id) + { + return apsShopMapper.deleteApsShopById(id); + } +} diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlantMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlantMapper.xml index a16e89e..6af672a 100644 --- a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlantMapper.xml +++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlantMapper.xml @@ -28,7 +28,7 @@ </where> </select> - <select id="selectApsPlantById" parameterType="Long" resultMap="ApsPlantResult"> + <select id="selectApsPlantById" parameterType="String" resultMap="ApsPlantResult"> <include refid="selectApsPlantVo"/> where id = #{id} </select> @@ -36,6 +36,7 @@ <insert id="insertApsPlant" parameterType="ApsPlant" useGeneratedKeys="true" keyProperty="id"> insert into aps_plant <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null and id != ''" >id,</if> <if test="plantName != null">plant_name,</if> <if test="plantCode != null">plant_code,</if> <if test="status != null">status,</if> @@ -45,6 +46,7 @@ <if test="updateTime != null">update_time,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null">#{id},</if> <if test="plantName != null">#{plantName},</if> <if test="plantCode != null">#{plantCode},</if> <if test="status != null">#{status},</if> @@ -69,7 +71,7 @@ where id = #{id} </update> - <delete id="deleteApsPlantById" parameterType="Long"> + <delete id="deleteApsPlantById" parameterType="String"> delete from aps_plant where id = #{id} </delete> diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsShopMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsShopMapper.xml new file mode 100644 index 0000000..90ca081 --- /dev/null +++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsShopMapper.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.aps.core.mapper.ApsShopMapper"> + + <resultMap type="ApsShop" id="ApsShopResult"> + <result property="id" column="id" /> + <result property="shopName" column="shop_name" /> + <result property="shopCode" column="shop_code" /> + <result property="plantCode" column="plant_code" /> + <result property="status" column="status" /> + <result property="createBy" column="create_by" /> + <result property="createTime" column="create_time" /> + <result property="updateBy" column="update_by" /> + <result property="updateTime" column="update_time" /> + </resultMap> + + <sql id="selectApsShopVo"> + select id, shop_name, shop_code, plant_code, status, create_by, create_time, update_by, update_time from aps_shop + </sql> + + <select id="selectApsShopList" parameterType="ApsShop" resultMap="ApsShopResult"> + <include refid="selectApsShopVo"/> + <where> + <if test="shopName != null and shopName != ''"> and shop_name like concat('%', #{shopName}, '%')</if> + <if test="shopCode != null and shopCode != ''"> and shop_code like concat('%', #{shopCode}, '%')</if> + <if test="plantCode != null and plantCode != ''"> and plant_code = #{plantCode}</if> + <if test="status != null and status != ''"> and status = #{status}</if> + </where> + </select> + + <select id="selectApsShopById" parameterType="String" resultMap="ApsShopResult"> + <include refid="selectApsShopVo"/> + where id = #{id} + </select> + + <insert id="insertApsShop" parameterType="ApsShop"> + insert into aps_shop + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null">id,</if> + <if test="shopName != null">shop_name,</if> + <if test="shopCode != null">shop_code,</if> + <if test="plantCode != null">plant_code,</if> + <if test="status != null">status,</if> + <if test="createBy != null">create_by,</if> + <if test="createTime != null">create_time,</if> + <if test="updateBy != null">update_by,</if> + <if test="updateTime != null">update_time,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null">#{id},</if> + <if test="shopName != null">#{shopName},</if> + <if test="shopCode != null">#{shopCode},</if> + <if test="plantCode != null">#{plantCode},</if> + <if test="status != null">#{status},</if> + <if test="createBy != null">#{createBy},</if> + <if test="createTime != null">#{createTime},</if> + <if test="updateBy != null">#{updateBy},</if> + <if test="updateTime != null">#{updateTime},</if> + </trim> + </insert> + + <update id="updateApsShop" parameterType="ApsShop"> + update aps_shop + <trim prefix="SET" suffixOverrides=","> + <if test="shopName != null">shop_name = #{shopName},</if> + <if test="shopCode != null">shop_code = #{shopCode},</if> + <if test="plantCode != null">plant_code = #{plantCode},</if> + <if test="status != null">status = #{status},</if> + <if test="createBy != null">create_by = #{createBy},</if> + <if test="createTime != null">create_time = #{createTime},</if> + <if test="updateBy != null">update_by = #{updateBy},</if> + <if test="updateTime != null">update_time = #{updateTime},</if> + </trim> + where id = #{id} + </update> + + <delete id="deleteApsShopById" parameterType="String"> + delete from aps_shop where id = #{id} + </delete> + + <delete id="deleteApsShopByIds" parameterType="String"> + delete from aps_shop where id in + <foreach item="id" collection="array" open="(" separator="," close=")"> + #{id} + </foreach> + </delete> +</mapper> \ No newline at end of file -- Gitblit v1.9.3