于继渤 2 лет назад
Родитель
Сommit
918e69a1ab

+ 65 - 3
src/main/java/com/dk/mdm/controller/mst/SaleChannelController.java

@@ -1,11 +1,15 @@
 package com.dk.mdm.controller.mst;
 package com.dk.mdm.controller.mst;
 
 
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.model.pojo.mst.SaleChannel;
 import com.dk.mdm.model.pojo.mst.SaleChannel;
-import com.dk.common.controller.BaseController;
 import com.dk.common.service.BaseService;
 import com.dk.common.service.BaseService;
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.dk.mdm.model.query.mst.SaleChannelQuery;
+import com.dk.mdm.model.response.mst.WarehouseResponse;
+import com.dk.mdm.model.vo.mst.SaleChannelVO;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RestController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import com.dk.mdm.service.mst.SaleChannelService;
 import com.dk.mdm.service.mst.SaleChannelService;
 
 
@@ -21,4 +25,62 @@ public class SaleChannelController{
     @Autowired
     @Autowired
     private SaleChannelService saleChannelService;
     private SaleChannelService saleChannelService;
 
 
+
+
+    /**
+     * @desc : 条件查询
+     * @author : 于继渤
+     * @date : 2024/2/26 10:36
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by"})
+    public ResponseResultVO<PageList<WarehouseResponse>> selectByCond(@RequestBody SaleChannelQuery saleChannelQuery) {
+        return saleChannelService.selectByCond(saleChannelQuery);
+    }
+
+    /**
+     * @desc : 新建
+     * @author : 于继渤
+     * @date : 2023/1/5 9:39
+     */
+    @ApiOperation(value = "新建", notes = "新建")
+    @PostMapping({"insert"})
+    public ResponseResultVO<?> insert(@RequestBody SaleChannelVO saleChannelVO) {
+        return saleChannelService.insert(saleChannelVO);
+    }
+
+
+    /**
+     * @desc : 编辑
+     * @author : 于继渤
+     * @date : 2023/1/5 9:39
+     */
+    @ApiOperation( value = "编辑", notes = "编辑" )
+    @PostMapping({"update"})
+    public ResponseResultVO<?> update(@RequestBody SaleChannelVO saleChannelVO) {
+        return saleChannelService.update(saleChannelVO);
+    }
+
+
+
+    /**
+     * @desc : 停用
+     * @author : 于继渤
+     * @date :  2023/1/4 9:39
+     */
+    @PostMapping("disable/{id}")
+    public ResponseResultVO<Boolean> disable(@PathVariable String id) {
+        return this.getService().disable(id);
+    }
+
+    /**
+     * @desc : 启用
+     * @author : 于继渤
+     * @date :  2023/1/4 9:39
+     */
+    @PostMapping("enable/{id}")
+    public ResponseResultVO<Boolean> enable(@PathVariable String id) {
+        return this.getService().enable(id);
+    }
+
 }
 }

+ 28 - 4
src/main/java/com/dk/mdm/mapper/mst/SaleChannelMapper.java

@@ -2,13 +2,37 @@ package com.dk.mdm.mapper.mst;
 
 
 import com.dk.mdm.model.pojo.mst.SaleChannel;
 import com.dk.mdm.model.pojo.mst.SaleChannel;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mst.SaleChannelQuery;
+import com.dk.mdm.model.response.mst.SaleChannelResponse;
 import org.springframework.stereotype.Repository;
 import org.springframework.stereotype.Repository;
 
 
+import java.util.List;
+
 /**
 /**
-*  销售渠道 Mapper
-*/
+ * 销售渠道 Mapper
+ */
 @Repository
 @Repository
-public interface SaleChannelMapper extends BaseMapper<SaleChannel>{
-	
+public interface SaleChannelMapper extends BaseMapper<SaleChannel> {
+    /**
+     * @desc : 根据条件进行查询
+     * @author : 于继渤
+     * @date : 2024/2/26 10:36
+     */
+    List<SaleChannelResponse> selectByCond(SaleChannelQuery saleChannelQuery);
+
+    /**
+     * @desc : 根据条件进行查询(数量)
+     * @author : 于继渤
+     * @date : 2024/2/26 10:36
+     */
+    Long countByCond(SaleChannelQuery saleChannelQuery);
+
+
+    /**
+     * @desc : 查询排序
+     * @author : 于继渤
+     * @date : 2024/2/26 10:36
+     */
+    Integer selectDisplayNo(SaleChannelQuery saleChannelQuery);
 }
 }
 
 

+ 24 - 7
src/main/java/com/dk/mdm/mapper/mst/SaleChannelMapper.xml

@@ -27,6 +27,18 @@
                 <result column="op_db_user" property="opDbUser"/>
                 <result column="op_db_user" property="opDbUser"/>
     </resultMap>
     </resultMap>
 
 
+
+    <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.mst.SaleChannelResponse">
+        <id column="channel_id" property="channelId"/>
+        <result column="channel_code" property="channelCode"/>
+        <result column="channel_name" property="channelName"/>
+        <result column="sys_code" property="sysCode"/>
+        <result column="display_no" property="displayNo"/>
+        <result column="remarks" property="remarks"/>
+        <result column="flg_valid" property="flgValid"/>
+        <result column="cp_id" property="cpId"/>
+
+    </resultMap>
     <!-- 通用条件列 -->
     <!-- 通用条件列 -->
     <sql id="Condition">
     <sql id="Condition">
         <where>
         <where>
@@ -84,10 +96,10 @@
     </sql>
     </sql>
 
 
     <!-- 查询表t_mst_sale_channel,(条件查询+分页)列表 -->
     <!-- 查询表t_mst_sale_channel,(条件查询+分页)列表 -->
-    <select id="selectByCond" resultMap="BaseResultMap">
+    <select id="selectByCond" resultMap="BaseResultMapResponse">
         SELECT
         SELECT
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>
-        FROM t_mst_sale_channel
+        FROM dkic_b.t_mst_sale_channel
         <include refid="Condition"/>
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
             limit #{end} offset #{start}
@@ -98,7 +110,7 @@
     <select id="countByCond" resultType="Long">
     <select id="countByCond" resultType="Long">
         SELECT
         SELECT
         count(1)
         count(1)
-        FROM t_mst_sale_channel
+        FROM dkic_b.t_mst_sale_channel
         <include refid="Condition"/>
         <include refid="Condition"/>
     </select>
     </select>
 
 
@@ -106,7 +118,7 @@
     <select id="selectById" resultMap="BaseResultMap">
     <select id="selectById" resultMap="BaseResultMap">
         SELECT
         SELECT
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>
-        FROM t_mst_sale_channel
+        FROM dkic_b.t_mst_sale_channel
         WHERE channel_id = #{channelId}::uuid
         WHERE channel_id = #{channelId}::uuid
     </select>
     </select>
 
 
@@ -114,7 +126,7 @@
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
     <select id="selectByIdForUpdate" resultMap="BaseResultMap">
         SELECT
         SELECT
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>
-        FROM t_mst_sale_channel
+        FROM dkic_b.t_mst_sale_channel
         WHERE channel_id = #{channelId}
         WHERE channel_id = #{channelId}
         for update
         for update
     </select>
     </select>
@@ -123,13 +135,13 @@
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
     <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
         SELECT
         SELECT
         <include refid="Base_Column_List"/>
         <include refid="Base_Column_List"/>
-        FROM t_mst_sale_channel
+        FROM dkic_b.t_mst_sale_channel
         <include refid="idsForeach"/>
         <include refid="idsForeach"/>
         for update
         for update
     </select>
     </select>
 
 
     <insert id="insertBatch">
     <insert id="insertBatch">
-        insert into t_mst_sale_channel
+        insert into dkic_b.t_mst_sale_channel
         (
         (
         <trim suffixOverrides=",">
         <trim suffixOverrides=",">
             channel_code,
             channel_code,
@@ -156,4 +168,9 @@
             )
             )
         </foreach>
         </foreach>
     </insert>
     </insert>
+
+    <select id="selectDisplayNo" resultType="Integer">
+        SELECT MAX(display_no) + 1  FROM dkic_b.t_mst_sale_channel
+        <include refid="Condition"/>
+    </select>
 </mapper>
 </mapper>

+ 4 - 3
src/main/java/com/dk/mdm/mapper/mst/WarehouseMapper.java

@@ -2,9 +2,10 @@ package com.dk.mdm.mapper.mst;
 
 
 import com.dk.mdm.model.pojo.mst.Warehouse;
 import com.dk.mdm.model.pojo.mst.Warehouse;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.common.mapper.BaseMapper;
-import com.dk.mdm.model.query.mst.GoodsBrandQuery;
+
 import com.dk.mdm.model.query.mst.WarehouseQuery;
 import com.dk.mdm.model.query.mst.WarehouseQuery;
-import com.dk.mdm.model.response.mst.GoodsBrandResponse;
+
+import com.dk.mdm.model.response.mst.WarehouseResponse;
 import org.springframework.stereotype.Repository;
 import org.springframework.stereotype.Repository;
 
 
 import java.util.List;
 import java.util.List;
@@ -19,7 +20,7 @@ public interface WarehouseMapper extends BaseMapper<Warehouse>{
      * @author : 于继渤
      * @author : 于继渤
      * @date : 2024/2/26 10:36
      * @date : 2024/2/26 10:36
      */
      */
-    List<GoodsBrandResponse> selectByCond(WarehouseQuery warehouseQuery);
+    List<WarehouseResponse> selectByCond(WarehouseQuery warehouseQuery);
 
 
     /**
     /**
      * @desc   : 根据条件进行查询(数量)
      * @desc   : 根据条件进行查询(数量)

+ 1 - 3
src/main/java/com/dk/mdm/mapper/mst/WarehouseMapper.xml

@@ -40,7 +40,6 @@
         <result column="contact_phone" property="contactPhone"/>
         <result column="contact_phone" property="contactPhone"/>
         <result column="remarks" property="remarks"/>
         <result column="remarks" property="remarks"/>
         <result column="flg_valid" property="flgValid"/>
         <result column="flg_valid" property="flgValid"/>
-        <result column="whTitle" property="whTitle"/>
         <result column="cp_id" property="cpId"/>
         <result column="cp_id" property="cpId"/>
 
 
     </resultMap>
     </resultMap>
@@ -110,8 +109,7 @@
     <!-- 查询表t_mst_warehouse,(条件查询+分页)列表 -->
     <!-- 查询表t_mst_warehouse,(条件查询+分页)列表 -->
     <select id="selectByCond" resultMap="BaseResultMapResponse">
     <select id="selectByCond" resultMap="BaseResultMapResponse">
         SELECT
         SELECT
-        <include refid="Base_Column_List"/>,
-        '仓库档案' AS "whTitle"
+        <include refid="Base_Column_List"/>
         FROM dkic_b.t_mst_warehouse
         FROM dkic_b.t_mst_warehouse
         <include refid="Condition"/>
         <include refid="Condition"/>
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">

+ 0 - 2
src/main/java/com/dk/mdm/model/response/mst/WarehouseResponse.java

@@ -117,8 +117,6 @@ public class WarehouseResponse  implements Serializable {
     @ApiModelProperty(value = "企业ID")
     @ApiModelProperty(value = "企业ID")
     private Integer cpId;
     private Integer cpId;
 
 
-    private String whTitle;
-
 
 
 
 
 
 

+ 88 - 0
src/main/java/com/dk/mdm/service/mst/SaleChannelService.java

@@ -1,13 +1,25 @@
 package com.dk.mdm.service.mst;
 package com.dk.mdm.service.mst;
 
 
+import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.infrastructure.constant.Constant;
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultUtil;
+import com.dk.common.response.ResponseResultVO;
+import com.dk.mdm.infrastructure.convert.mst.SaleChannelConvert;
 import com.dk.mdm.model.pojo.mst.SaleChannel;
 import com.dk.mdm.model.pojo.mst.SaleChannel;
 import com.dk.mdm.mapper.mst.SaleChannelMapper;
 import com.dk.mdm.mapper.mst.SaleChannelMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.query.mst.SaleChannelQuery;
+import com.dk.mdm.model.response.mst.WarehouseResponse;
+import com.dk.mdm.model.vo.mst.SaleChannelVO;
+import com.dk.mdm.service.common.CommonService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
+import java.util.Map;
+
 @Service
 @Service
 @Transactional
 @Transactional
 public class SaleChannelService extends BaseService<SaleChannel> {
 public class SaleChannelService extends BaseService<SaleChannel> {
@@ -20,4 +32,80 @@ public class SaleChannelService extends BaseService<SaleChannel> {
 	@Autowired
 	@Autowired
 	private SaleChannelMapper saleChannelMapper;
 	private SaleChannelMapper saleChannelMapper;
 
 
+	@Autowired
+	private CommonService commonService;
+
+
+	@Autowired
+	private SaleChannelConvert saleChannelConvert;
+
+	/**
+	 * @desc : 重写主键
+	 * @author : 于继渤
+	 * @date : 2024/2/29 20:29
+	 */
+	@Override
+	public String getPrimaryKey() {
+		return "channel_id";
+	}
+
+
+	/**
+	 * @desc : 查询
+	 * @author : 于继渤
+	 * @date : 2023/1/5 9:39
+	 */
+	@Pagination
+	public ResponseResultVO<PageList<WarehouseResponse>> selectByCond(SaleChannelQuery saleChannelQuery) {
+		return super.mergeListWithCount(saleChannelQuery, saleChannelMapper.selectByCond(saleChannelQuery),
+				saleChannelMapper.countByCond(saleChannelQuery));
+	}
+
+
+
+	/**
+	 * @desc : 新建
+	 * @author : 于继渤
+	 * @date : 2023/1/5 9:39
+	 */
+	@Transactional(
+			rollbackFor = {Exception.class}
+	)
+	public ResponseResultVO<?> insert(SaleChannelVO saleChannelVO) {
+		//实体转换
+		SaleChannel saleChannel = saleChannelConvert.convertToPo(saleChannelVO);
+
+		Integer displayNo = saleChannelMapper.selectDisplayNo(new SaleChannelQuery());
+		if (displayNo != null) {
+			//插入序号
+			saleChannel.setDisplayNo(displayNo);
+		} else {
+			saleChannel.setDisplayNo(0);
+		}
+		//设置编码
+		Map<String, Object> uniqueNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.SALECHANNEL.getName(), true);
+		saleChannel.setChannelId(uniqueNoteCode.get("outId").toString());
+		saleChannel.setChannelCode(uniqueNoteCode.get("outNote").toString());
+		//新建
+		saleChannelMapper.insert(saleChannel);
+
+		return ResponseResultUtil.success();
+	}
+
+
+
+	/**
+	 * @desc : 编辑
+	 * @author : 于继渤
+	 * @date : 2023/1/5 9:39
+	 */
+	@Transactional(
+			rollbackFor = {Exception.class}
+	)
+	public ResponseResultVO<?> update(SaleChannelVO saleChannelVO) {
+		SaleChannel saleChannel = saleChannelConvert.convertToPo(saleChannelVO);
+		super.updateByUuid(saleChannel);
+		return ResponseResultUtil.success();
+	}
+
 }
 }