From bd18a7feba1fa1b6d8c510507249451d320f2660 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期一, 13 十一月 2023 09:29:51 +0800
Subject: [PATCH] 角色管理实现
---
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/QueryVo.java | 20 ++
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaRoleMapper.java | 60 +++++
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRole.java | 19 ++
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java | 101 +++++++++++
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaRoleMapper.xml | 72 +++++++
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java | 10
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaPrivilegeMapper.java | 1
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleCtrl.java | 223 ++++++++++++++++++++++++
8 files changed, 493 insertions(+), 13 deletions(-)
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaPrivilegeMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaPrivilegeMapper.java
index e622e47..240b513 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaPrivilegeMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaPrivilegeMapper.java
@@ -7,6 +7,7 @@
import java.util.List;
public interface BaPrivilegeMapper extends BaseMapper<BaPrivilege> {
+
/**
* 鏌ヨ鍏ㄩ儴
* @return List<BaPrivilege>
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaRoleMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaRoleMapper.java
index 6f5f42c..0b1841e 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaRoleMapper.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoBa/BaRoleMapper.java
@@ -6,9 +6,40 @@
import org.apache.ibatis.annotations.Param;
import java.util.List;
+import java.util.Map;
@Mapper
public interface BaRoleMapper extends BaseMapper<BaRole> {
+
+ /**
+ * 鏌ヨ鍏ㄩ儴
+ * @return List<BaRole>
+ */
+ List<BaRole> selectAll(Map<?, ?> params) ;
+
+ /**
+ * 鏌ヨ鏌愪釜鐢ㄦ埛鎵�闅跺睘浜庣殑瑙掕壊
+ * @param userId 鐢ㄦ埛ID
+ * @return List<BaRole>
+ */
+ List<BaRole> selectByUserId(@Param("userId") Long userId) ;
+
+
+ /**
+ * 鏌ヨ鎬绘暟
+ * @param params 鏌ヨ鏉′欢
+ * @return 鎬绘暟
+ */
+ Long selectTotal(Map<?, ?> params) ;
+
+ /**
+ * 鍒嗛〉鏌ヨ涓�浜�
+ * @param params 鏌ヨ鏉′欢
+ * @return 瀹炰綋闆嗗悎
+ */
+ List<BaRole> selectSome(Map<?, ?> params) ;
+
+
/**
* insert record to table
* @param record the record
@@ -24,15 +55,30 @@
int insertSelective(BaRole record);
/**
- * 鏌ヨ鍏ㄩ儴
- * @return List<BaRole>
+ * update record selective
+ * @param record the updated record
+ * @return update count
*/
- List<BaRole> selectAll() ;
+ int updateByPrimaryKeySelective(BaRole record);
/**
- * 鏌ヨ鏌愪釜鐢ㄦ埛鎵�闅跺睘浜庣殑瑙掕壊
- * @param userId 鐢ㄦ埛ID
- * @return List<BaRole>
+ * update record
+ * @param record the updated record
+ * @return update count
*/
- List<BaRole> selectByUserId(@Param("userId") Long userId) ;
+ int updateByPrimaryKey(BaRole record);
+
+ /**
+ * delete by primary key
+ * @param id primaryKey
+ * @return deleteCount
+ */
+ int deleteByPrimaryKey(Long id);
+
+ /**
+ * 閫昏緫鍒犻櫎
+ * @param id primaryKey
+ * @return update count
+ */
+ int deleteLogicById(Long id);
}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRole.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRole.java
index bf2b547..9c87042 100644
--- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRole.java
+++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaRole.java
@@ -4,11 +4,17 @@
import com.alibaba.fastjson2.annotation.JSONField;
import com.alibaba.fastjson2.writer.ObjectWriterImplToString;
import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dy.common.mybatis.envm.Deleted;
import com.dy.common.po.BaseEntity;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotEmpty;
import lombok.*;
+import org.hibernate.validator.constraints.Length;
+
+import java.util.List;
/**
* 瑙掕壊瀹炰綋
@@ -19,22 +25,35 @@
@ToString
@NoArgsConstructor
@AllArgsConstructor
+@Schema(name = "瑙掕壊瀹炰綋")
public class BaRole implements BaseEntity {
public static final long serialVersionUID = 202310211546001L;
@JSONField(serializeUsing= ObjectWriterImplToString.class)
@TableId(type = IdType.INPUT)
+ @Schema(description = "瀹炰綋id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Long id ;
/**
* 瑙掕壊鍚嶇О
*/
+ @Schema(description = "鍚嶇О", requiredMode = Schema.RequiredMode.REQUIRED)
+ @NotEmpty(message = "鍚嶇О涓嶈兘涓虹┖") //涓嶈兘涓虹┖涔熶笉鑳戒负null
+ @Length(message = "鍚嶇О涓嶅ぇ浜巤max}瀛楃锛屼笉灏忎簬{min}瀛楃", min = 2, max = 25)
public String name ;
/**
* 鏄惁鍒犻櫎: 0琛ㄧず鏈垹闄� 1琛ㄧず鍒犻櫎.
*/
+ @Schema(description = "鍒犻櫎鏍囪瘑锛岃〃鍗曚笉鐢ㄥ~鍐�", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
public Deleted deleted;
+
+ /**
+ * 瑙掕壊鎵�鎷ユ湁鐨勬潈闄�
+ */
+ @TableField(exist = false)
+ public List<BaPrivilege> priviList ;
+
}
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaRoleMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaRoleMapper.xml
index 660cf0d..090085b 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaRoleMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaRoleMapper.xml
@@ -13,6 +13,10 @@
<result column="name" jdbcType="VARCHAR" property="name" />
</resultMap>
+ <resultMap id="someResultMap" extends="partResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaRole">
+ <collection property="priviList" fetchType="eager" column="{roleId=id}" select="com.dy.pipIrrGlobal.daoBa.BaPrivilegeMapper.selectPrivilegeByRoleId" />
+ </resultMap>
+
<sql id="Base_Column_List">
id, name, deleted
</sql>
@@ -23,8 +27,14 @@
<select id="selectAll" resultMap="BaseResultMap">
select
- <include refid="Base_Column_List" />
+ <include refid="part_Column_List" />
from ba_role
+ where deleted!=1
+ <trim prefix="and" suffixOverrides="and">
+ <if test="name != null">
+ name like concat('%', #{name}, '%')
+ </if>
+ </trim>
</select>
<select id="selectByUserId" resultMap="partResultMap">
@@ -35,6 +45,34 @@
<if test="userId != null">
and ur.userId = #{userId,jdbcType=BIGINT}
</if>
+ </select>
+
+ <select id="selectTotal" parameterType="java.util.Map" resultType="java.lang.Long">
+ select
+ count(*)
+ from ba_role where deleted!=1
+ <trim prefix="and" suffixOverrides="and">
+ <if test="name != null">
+ name like concat('%', #{name}, '%')
+ </if>
+ </trim>
+ </select>
+
+ <select id="selectSome" parameterType="java.util.Map" resultMap="someResultMap">
+ select
+ <include refid="part_Column_List" />
+ from ba_role where deleted!=1
+ <trim prefix="and" suffixOverrides="and">
+ <if test="name != null">
+ name like concat('%', #{name}, '%')
+ </if>
+ </trim>
+ order by id DESC
+ <trim prefix="limit " >
+ <if test="start != null and count != null">
+ #{start}, #{count}
+ </if>
+ </trim>
</select>
<insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaRole">
@@ -70,4 +108,36 @@
</if>
</trim>
</insert>
+
+
+ <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser">
+ update ba_role
+ <set>
+ <if test="name != null">
+ `name` = #{name,jdbcType=VARCHAR},
+ </if>
+ <if test="deleted != null">
+ deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT},
+ </if>
+ </set>
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+
+ <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaUser">
+ update ba_role
+ set `name` = #{name,jdbcType=VARCHAR},
+ deleted = #{deleted,typeHandler=com.dy.common.mybatis.envm.EnumCodeTypeHandler, jdbcType=TINYINT}
+ where id = #{id,jdbcType=BIGINT}
+ </update>
+
+
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+ delete from ba_role
+ where id = #{id,jdbcType=BIGINT}
+ </delete>
+
+ <delete id="deleteLogicById" parameterType="java.lang.Long">
+ update ba_role set deleted = 1
+ where id = #{id,jdbcType=BIGINT}
+ </delete>
</mapper>
\ No newline at end of file
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/QueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/QueryVo.java
new file mode 100644
index 0000000..fd9bc41
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/QueryVo.java
@@ -0,0 +1,20 @@
+package com.dy.pipIrrBase.role;
+
+
+import com.dy.common.webUtil.QueryConditionVo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+@ToString(callSuper = true)
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@Schema(name = "瑙掕壊鏌ヨ鏉′欢")
+public class QueryVo extends QueryConditionVo {
+
+ @Schema(description = "瑙掕壊鍚嶇О")
+ public String name;
+}
+
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleCtrl.java
new file mode 100644
index 0000000..9cc6bd7
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleCtrl.java
@@ -0,0 +1,223 @@
+package com.dy.pipIrrBase.role;
+
+import com.dy.common.aop.SsoAop;
+import com.dy.common.mybatis.envm.Deleted;
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.common.webUtil.ResultCodeMsg;
+import com.dy.pipIrrBase.user.QueryVo;
+import com.dy.pipIrrGlobal.pojoBa.BaRole;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Objects;
+
+@Slf4j
+@Tag(name = "瑙掕壊绠$悊", description = "瑙掕壊澧炲垹鏀规煡绛夋搷浣�")
+@RestController
+@RequestMapping(path="role")
+@SuppressWarnings("unchecked")//java鐗堟湰瓒婇珮锛屽娉涘瀷绾︽潫瓒婁弗锛屾墍浠ラ厤缃甋uppressWarnings("unchecked")
+public class RoleCtrl {
+
+ private RoleSv sv ;
+
+ @Autowired
+ private void setSv(RoleSv sv){
+ this.sv = sv ;
+ }
+
+ /**
+ * 瀹㈡埛绔姹傚緱鍒版墍鏈夎鑹叉暟鎹�
+ * @return 鎵�鏈夎鑹叉暟鎹�
+ */
+ @Operation(summary = "鑾峰緱鍏ㄩ儴瑙掕壊", description = "杩斿洖鍏ㄩ儴瑙掕壊鏁版嵁")
+ @ApiResponses(value = {
+ @ApiResponse(
+ responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+ description = "杩斿洖鍏ㄩ儴瑙掕壊鏁版嵁锛圔aseResponse.content:QueryResultVo[{}]锛�",
+ content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+ schema = @Schema(implementation = BaRole.class))}
+ )
+ })
+ @PostMapping(path = "all")
+ @SsoAop("-1")
+ public BaseResponse<QueryResultVo<List<BaRole>>> all(QueryVo vo){
+ try {
+ QueryResultVo<List<BaRole>> res = this.sv.selectAll(vo) ;
+ return BaseResponseUtils.buildSuccess(res);
+ } catch (Exception e) {
+ log.error("鏌ヨ瑙掕壊寮傚父", e);
+ return BaseResponseUtils.buildException(e.getMessage()) ;
+ }
+ }
+
+ /**
+ * 瀹㈡埛绔姹傚緱鍒版墍鏈夎鑹叉暟鎹�
+ * @return 鎵�鏈夎鑹叉暟鎹�
+ */
+ @Operation(summary = "鑾峰緱涓�椤佃鑹�", description = "杩斿洖涓�椤佃鑹叉暟鎹�")
+ @ApiResponses(value = {
+ @ApiResponse(
+ responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+ description = "杩斿洖涓�椤佃鑹叉暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�",
+ content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+ schema = @Schema(implementation = BaRole.class))}
+ )
+ })
+ @PostMapping(path = "some")
+ @SsoAop("-1")
+ public BaseResponse<QueryResultVo<List<BaRole>>> some(QueryVo vo){
+ try {
+ QueryResultVo<List<BaRole>> res = this.sv.selectSome(vo) ;
+ return BaseResponseUtils.buildSuccess(res);
+ } catch (Exception e) {
+ log.error("鏌ヨ瑙掕壊寮傚父", e);
+ return BaseResponseUtils.buildException(e.getMessage()) ;
+ }
+ }
+
+ /**
+ * 寰楀埌涓�涓鑹叉暟鎹�
+ * @return 涓�涓鑹叉暟鎹�
+ */
+ @Operation(summary = "涓�涓鑹�", description = "寰楀埌涓�涓鑹叉暟鎹�")
+ @ApiResponses(value = {
+ @ApiResponse(
+ responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+ description = "杩斿洖涓�涓鑹叉暟鎹紙BaseResponse.content:{}锛�",
+ content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+ schema = @Schema(implementation = BaRole.class))}
+ )
+ })
+ @GetMapping(path = "one")
+ @SsoAop("-1")
+ public BaseResponse<BaRole> one(@Parameter(description = "瀹炰綋id", required = true) Long id){
+ return BaseResponseUtils.buildSuccess(this.sv.selectById(id));
+ }
+
+ /**
+ * 淇濆瓨瑙掕壊
+ * @param po 淇濆瓨瑙掕壊form琛ㄥ崟瀵硅薄
+ * @return 鏄惁鎴愬姛
+ */
+ @Operation(summary = "淇濆瓨瑙掕壊", description = "鎻愪氦瑙掕壊鏁版嵁锛坒orm琛ㄥ崟锛夛紝杩涜淇濆瓨")
+ @ApiResponses(value = {
+ @ApiResponse(
+ responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+ description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
+ content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+ schema = @Schema(implementation = Boolean.class))}
+ )
+ })
+ @PostMapping(path = "save", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+ @SsoAop("-1")//@SsoAop(power = "-1")
+ public BaseResponse<Boolean> save(@Parameter(description = "form琛ㄥ崟鏁版嵁", required = true) @Valid BaRole po, @Parameter(hidden = true) BindingResult bindingResult){
+ if(bindingResult != null && bindingResult.hasErrors()){
+ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+ po.id = null ;
+ int count;
+ try {
+ po.deleted = Deleted.NO ;//榛樿涓嶅垹闄�
+ count = this.sv.save(po);
+ } catch (Exception e) {
+ log.error("淇濆瓨瑙掕壊寮傚父", e);
+ return BaseResponseUtils.buildException(e.getMessage()) ;
+ }
+ if(count <= 0){
+ return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ;
+ }else{
+ return BaseResponseUtils.buildSuccess(true) ;
+ }
+ }
+
+ /**
+ * 缂栬緫淇敼瑙掕壊
+ * @param po 淇濆瓨瑙掕壊form琛ㄥ崟瀵硅薄
+ * @return 鏄惁鎴愬姛
+ */
+ @Operation(summary = "缂栬緫淇敼瑙掕壊", description = "鎻愪氦瑙掕壊鏁版嵁锛坒orm琛ㄥ崟锛夛紝杩涜淇敼")
+ @ApiResponses(value = {
+ @ApiResponse(
+ responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+ description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
+ content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+ schema = @Schema(implementation = Boolean.class))}
+ )
+ })
+ @PostMapping(path = "update", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+ @SsoAop("-1")//@SsoAop(power = "-1")
+ public BaseResponse<Boolean> update(@Parameter(description = "form琛ㄥ崟鏁版嵁", required = true) @Valid BaRole po, @Parameter(hidden = true) BindingResult bindingResult){
+ if(bindingResult != null && bindingResult.hasErrors()){
+ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+ }
+ if(po.id == null){
+ return BaseResponseUtils.buildFail("鏃犳暟鎹疄浣揑D") ;
+ }
+ int count;
+ try {
+ po.deleted = null ;//璁剧疆涓簄ull锛屼笉鍋氭洿鏂�
+ count = this.sv.update(po);
+ } catch (Exception e) {
+ log.error("淇濆瓨瑙掕壊寮傚父", e);
+ return BaseResponseUtils.buildException(e.getMessage()) ;
+ }
+ if(count <= 0){
+ return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ;
+ }else{
+ return BaseResponseUtils.buildSuccess(true) ;
+ }
+ }
+
+
+ /**
+ * 鍒犻櫎瑙掕壊
+ * @param id 瑙掕壊ID
+ * @return 鏄惁鎴愬姛
+ */
+ @Operation(summary = "鍒犻櫎瑙掕壊", description = "鎻愪氦瑙掕壊ID锛岃繘琛岄�昏緫鍒犻櫎")
+ @ApiResponses(value = {
+ @ApiResponse(
+ responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+ description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�",
+ content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+ schema = @Schema(implementation = Boolean.class))}
+ )
+ })
+ @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE)
+ @SsoAop("-1")//@SsoAop(power = "-1")
+ public BaseResponse<Boolean> delete(@Parameter(description = "瀹炰綋id", required = true) Long id){
+ if(id == null){
+ return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ;
+ }
+ int count;
+ try {
+ count = this.sv.delete(id);
+ } catch (Exception e) {
+ log.error("淇濆瓨瑙掕壊寮傚父", e);
+ return BaseResponseUtils.buildException(e.getMessage()) ;
+ }
+ if(count <= 0){
+ return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ;
+ }else{
+ return BaseResponseUtils.buildSuccess(true) ;
+ }
+ }
+
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java
new file mode 100644
index 0000000..b6bd5d2
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleSv.java
@@ -0,0 +1,101 @@
+package com.dy.pipIrrBase.role;
+
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.pipIrrBase.user.QueryVo;
+import com.dy.pipIrrGlobal.daoBa.BaRoleMapper;
+import com.dy.pipIrrGlobal.pojoBa.BaRole;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.common.utils.PojoUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Service
+public class RoleSv {
+
+ private BaRoleMapper dao;
+
+ @Autowired
+ private void setDao(BaRoleMapper dao){
+ this.dao = dao;
+ }
+
+
+ /**
+ * 寰楀埌鎵�鏈夎鑹�
+ * @return 鎵�鏈夎鑹查泦鍚�
+ */
+ @SuppressWarnings("unchecked")
+ public QueryResultVo<List<BaRole>> selectAll(QueryVo vo){
+ Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ;
+ QueryResultVo<List<BaRole>> rsVo = new QueryResultVo<>() ;
+ rsVo.obj = this.dao.selectAll(params) ;
+ return rsVo ;
+ }
+
+
+ /**
+ * 寰楀埌涓�涓鑹�
+ * @param id 瑙掕壊ID
+ * @return 瑙掕壊瀹炰綋
+ */
+ public BaRole selectById(Long id){
+ return this.dao.selectById(id) ;
+ }
+
+
+ /**
+ * 寰楀埌涓�涓敤鎴�
+ * @param vo 鏌ヨ鏉′欢鍊煎璞�
+ * @return 鐢ㄦ埛瀹炰綋
+ */
+ @SuppressWarnings("unchecked")
+ public QueryResultVo<List<BaRole>> selectSome(QueryVo vo){
+ Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ;
+ Long itemTotal = this.dao.selectTotal(params) ;
+
+ QueryResultVo<List<BaRole>> rsVo = new QueryResultVo<>() ;
+ rsVo.pageSize = vo.pageSize ;
+ rsVo.pageCurr = vo.pageCurr ;
+ rsVo.calculateAndSet(itemTotal, params);
+ rsVo.obj = this.dao.selectSome(params) ;
+
+ return rsVo ;
+ }
+
+ /**
+ * 淇濆瓨瀹炰綋
+ * @param po 瀹炰綋
+ * @return 褰卞搷璁板綍鏁伴噺
+ */
+ @Transactional
+ public int save(BaRole po){
+ return this.dao.insert(po) ;
+ }
+
+ /**
+ * 淇濆瓨淇敼瀹炰綋
+ * @param po 瀹炰綋
+ * @return 褰卞搷璁板綍鏁伴噺
+ */
+ @Transactional
+ public int update(BaRole po){
+ return this.dao.updateByPrimaryKeySelective(po) ;
+ }
+
+ /**
+ * 淇濆瓨淇敼瀹炰綋
+ * @param id 瀹炰綋ID
+ * @return 褰卞搷璁板綍鏁伴噺
+ */
+ @Transactional
+ public int delete(Long id){
+ return this.dao.deleteLogicById(id) ;
+ }
+
+
+}
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java
index d03c8ae..9eee7c2 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserSv.java
@@ -26,18 +26,18 @@
}
/**
- * 寰楀埌涓�涓墖鍖�
- * @param id 鐗囧尯ID
- * @return 鐗囧尯瀹炰綋
+ * 寰楀埌涓�涓敤鎴�
+ * @param id 鐢ㄦ埛ID
+ * @return 鐢ㄦ埛瀹炰綋
*/
public BaUser selectById(Long id){
return this.dao.selectById(id) ;
}
/**
- * 寰楀埌涓�涓墖鍖�
+ * 寰楀埌涓�涓敤鎴�
* @param vo 鏌ヨ鏉′欢鍊煎璞�
- * @return 鐗囧尯瀹炰綋
+ * @return 鐢ㄦ埛瀹炰綋
*/
@SuppressWarnings("unchecked")
public QueryResultVo<List<BaUser>> selectSome(QueryVo vo){
--
Gitblit v1.8.0