zouxuan 3 年之前
父節點
當前提交
0c5bdd8a1d

+ 11 - 2
mec-biz/src/main/resources/config/mybatis/PracticeGroupSellPriceMapper.xml

@@ -83,12 +83,21 @@
 	<select id="queryPage" resultMap="PracticeGroupSellPrice" parameterType="map">
 		SELECT pgsp.*,o.name_ organ_name_ FROM practice_group_sell_price pgsp
 		LEFT JOIN organization o ON o.id_ = pgsp.organ_id_
-		WHERE pgsp.tenant_id_ = #{tenantId} ORDER BY pgsp.organ_id_
+		WHERE pgsp.tenant_id_ = #{tenantId}
+		<if test="search != null and search != ''">
+			AND o.name_ LIKE CONCAT('%',#{search},'%')
+		</if>
+		ORDER BY pgsp.organ_id_
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM practice_group_sell_price where tenant_id_ = #{tenantId}
+		SELECT COUNT(DISTINCT pgsp.organ_id_) FROM practice_group_sell_price pgsp
+		LEFT JOIN organization o ON o.id_ = pgsp.organ_id_
+		WHERE pgsp.tenant_id_ = #{tenantId}
+		<if test="search != null and search != ''">
+			AND o.name_ LIKE CONCAT('%',#{search},'%')
+		</if>
 	</select>
 </mapper>

+ 19 - 10
mec-web/src/main/java/com/ym/mec/web/controller/PracticeGroupSellPriceController.java

@@ -1,11 +1,13 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.entity.PracticeGroupSellPrice;
+import com.ym.mec.biz.service.PracticeGroupSellPriceService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
-
-import java.util.Date;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -14,18 +16,13 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.biz.dal.entity.PracticeGroupSellPrice;
-import com.ym.mec.biz.service.PracticeGroupSellPriceService;
-import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.page.QueryInfo;
+import java.util.Date;
 
 @RequestMapping("practiceGroupSellPrice")
 @Api(tags = "网管课价格配置")
 @RestController
 public class PracticeGroupSellPriceController extends BaseController {
 
-
 	@Autowired
 	private PracticeGroupSellPriceService practiceGroupSellPriceService;
 
@@ -48,7 +45,10 @@ public class PracticeGroupSellPriceController extends BaseController {
 	@PostMapping(value = "/add", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 	@PreAuthorize("@pcs.hasPermissions('practiceGroupSellPrice/add')")
 	public Object add(PracticeGroupSellPrice practiceGroupSellPrice) {
-
+		PracticeGroupSellPrice practiceGroupSellPrice1 = practiceGroupSellPriceService.get(practiceGroupSellPrice.getOrganId());
+		if(practiceGroupSellPrice1 != null){
+			throw new BizException("数据已存在");
+		}
 		Date date = new Date();
 		practiceGroupSellPrice.setCreateTime(date);
 		practiceGroupSellPrice.setUpdateTime(date);
@@ -64,4 +64,13 @@ public class PracticeGroupSellPriceController extends BaseController {
 		practiceGroupSellPriceService.update(practiceGroupSellPrice);
 		return succeed();
 	}
+
+	@ApiOperation("删除")
+	@PostMapping(value = "/del")
+	@ApiImplicitParam(name = "organId", value = "分部编号", required = true, dataType = "Integer", paramType = "path")
+	@PreAuthorize("@pcs.hasPermissions('practiceGroupSellPrice/del')")
+	public Object del(Integer organId) {
+		practiceGroupSellPriceService.delete(organId);
+		return succeed();
+	}
 }