forked from luyan/epmet-cloud-lingshan
				
			
				 14 changed files with 615 additions and 1 deletions
			
			
		@ -0,0 +1,99 @@ | 
				
			|||||
 | 
					package com.epmet.dto; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import java.io.Serializable; | 
				
			||||
 | 
					import java.util.Date; | 
				
			||||
 | 
					import lombok.Data; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 党员风采分类字典表 | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author generator generator@elink-cn.com | 
				
			||||
 | 
					 * @since v1.0.0 2022-02-12 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@Data | 
				
			||||
 | 
					public class IcPartymemberStyleCategoryDictDTO implements Serializable { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    private static final long serialVersionUID = 1L; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 楼栋主键 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String id; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 客户id | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String customerId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 上级分类ID 顶级此列存储0 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String pid; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 所有上级分类ID英文顿号隔开,顶级此列存储0 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String pids; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 分类编码,分类编码+customer_id唯一;从1000开始 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String categoryCode; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 上级分类编码 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String parentCategoryCode; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 分类名称 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String categoryName; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 分类级别1,2,3,4.... 目前只有一级 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private Integer level; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 排序 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private Integer sort; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 0:可用;1:被禁用。默认0 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private Boolean beDisabled; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 删除标识 0未删除、1已删除 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String delFlag; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 乐观锁 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private Integer revision; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 创建人 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String createdBy; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 创建时间 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private Date createdTime; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 更新人 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String updatedBy; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 更新时间 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private Date updatedTime; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,36 @@ | 
				
			|||||
 | 
					package com.epmet.resi.partymember.dto.partymember.form; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; | 
				
			||||
 | 
					import lombok.Data; | 
				
			||||
 | 
					import org.hibernate.validator.constraints.Length; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import javax.validation.constraints.NotBlank; | 
				
			||||
 | 
					import java.io.Serializable; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 【党员风采分类】添加或修改分类 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@Data | 
				
			||||
 | 
					public class AddStyleCategoryFormDTO implements Serializable { | 
				
			||||
 | 
					    public interface AddUserInternalGroup { | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public interface AddUserShowGroup extends CustomerClientShowGroup { | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class) | 
				
			||||
 | 
					    private String customerId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 分类名称 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @NotBlank(message = "分类名称不能为空", groups = AddUserShowGroup.class) | 
				
			||||
 | 
					    @Length(max = 10, groups = AddUserShowGroup.class) | 
				
			||||
 | 
					    private String categoryName; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 主键 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    private String categoryId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,15 @@ | 
				
			|||||
 | 
					package com.epmet.resi.partymember.dto.partymember.form; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import lombok.Data; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import javax.validation.constraints.NotBlank; | 
				
			||||
 | 
					import java.io.Serializable; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					@Data | 
				
			||||
 | 
					public class StyleCategoryCommonFormDTO implements Serializable { | 
				
			||||
 | 
					    private static final long serialVersionUID = -291713921309878763L; | 
				
			||||
 | 
					    public interface AddUserInternalGroup {} | 
				
			||||
 | 
					    @NotBlank(message = "customerId不能为空",groups = AddUserInternalGroup.class) | 
				
			||||
 | 
					    private String customerId; | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,30 @@ | 
				
			|||||
 | 
					package com.epmet.resi.partymember.dto.partymember.form; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import lombok.Data; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import javax.validation.constraints.NotBlank; | 
				
			||||
 | 
					import javax.validation.constraints.NotNull; | 
				
			||||
 | 
					import java.io.Serializable; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					@Data | 
				
			||||
 | 
					public class UpdateStyleCategoryFormDTO implements Serializable { | 
				
			||||
 | 
					    public interface DeleteInternalGroup { | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					    public interface UpdateStatusInternalGroup { | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 主键 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @NotBlank(message = "categoryId不能为空", groups = {DeleteInternalGroup.class,UpdateStatusInternalGroup.class}) | 
				
			||||
 | 
					    private String categoryId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 0:可用;1:被禁用。默认0 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @NotNull(message = "beDisabled不能为空", groups = {UpdateStatusInternalGroup.class}) | 
				
			||||
 | 
					    private Boolean beDisabled; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    private String userId; | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,27 @@ | 
				
			|||||
 | 
					package com.epmet.resi.partymember.dto.partymember.result; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import lombok.Data; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import java.io.Serializable; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 【党员风采分类】列表查询 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@Data | 
				
			||||
 | 
					public class StyleCategoryDictResDTO implements Serializable { | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 主键 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    private String categoryId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 分类名称 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    private String categoryName; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 0:可用;1:被禁用。默认0 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    private Boolean beDisabled; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,87 @@ | 
				
			|||||
 | 
					package com.epmet.modules.partymember.controller; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.epmet.commons.tools.annotation.LoginUser; | 
				
			||||
 | 
					import com.epmet.commons.tools.page.PageData; | 
				
			||||
 | 
					import com.epmet.commons.tools.security.dto.TokenDto; | 
				
			||||
 | 
					import com.epmet.commons.tools.utils.Result; | 
				
			||||
 | 
					import com.epmet.commons.tools.validator.ValidatorUtils; | 
				
			||||
 | 
					import com.epmet.commons.tools.validator.group.AddGroup; | 
				
			||||
 | 
					import com.epmet.commons.tools.validator.group.DefaultGroup; | 
				
			||||
 | 
					import com.epmet.commons.tools.validator.group.UpdateGroup; | 
				
			||||
 | 
					import com.epmet.dto.IcPartymemberStyleCategoryDictDTO; | 
				
			||||
 | 
					import com.epmet.modules.partymember.service.IcPartymemberStyleCategoryDictService; | 
				
			||||
 | 
					import com.epmet.resi.partymember.dto.partymember.form.AddStyleCategoryFormDTO; | 
				
			||||
 | 
					import com.epmet.resi.partymember.dto.partymember.form.StyleCategoryCommonFormDTO; | 
				
			||||
 | 
					import com.epmet.resi.partymember.dto.partymember.form.UpdateStyleCategoryFormDTO; | 
				
			||||
 | 
					import com.epmet.resi.partymember.dto.partymember.result.StyleCategoryDictResDTO; | 
				
			||||
 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
 | 
					import org.springframework.web.bind.annotation.*; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import java.util.List; | 
				
			||||
 | 
					import java.util.Map; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 党员风采分类字典表 | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author generator generator@elink-cn.com | 
				
			||||
 | 
					 * @since v1.0.0 2022-02-12 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@RestController | 
				
			||||
 | 
					@RequestMapping("stylecategorydict") | 
				
			||||
 | 
					public class IcPartymemberStyleCategoryDictController { | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    @Autowired | 
				
			||||
 | 
					    private IcPartymemberStyleCategoryDictService icPartymemberStyleCategoryDictService; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 【党员风采分类】列表查询 | 
				
			||||
 | 
					     * @param formDTO | 
				
			||||
 | 
					     * @return | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @PostMapping("list") | 
				
			||||
 | 
					    public Result<List<StyleCategoryDictResDTO>> list(@RequestBody StyleCategoryCommonFormDTO formDTO){ | 
				
			||||
 | 
					        ValidatorUtils.validateEntity(formDTO,StyleCategoryCommonFormDTO.AddUserInternalGroup.class); | 
				
			||||
 | 
					        return new Result<List<StyleCategoryDictResDTO>>().ok(icPartymemberStyleCategoryDictService.queryList(formDTO.getCustomerId())); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 【党员风采分类】添加或修改分类 | 
				
			||||
 | 
					     * @param formDTO | 
				
			||||
 | 
					     * @return | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @PostMapping("addorupdate") | 
				
			||||
 | 
					    public Result addOrUpdate(@RequestBody AddStyleCategoryFormDTO formDTO){ | 
				
			||||
 | 
					        ValidatorUtils.validateEntity(formDTO, AddStyleCategoryFormDTO.AddUserInternalGroup.class,AddStyleCategoryFormDTO.AddUserShowGroup.class); | 
				
			||||
 | 
					        icPartymemberStyleCategoryDictService.addOrUpdate(formDTO); | 
				
			||||
 | 
					        return new Result(); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 【党员风采分类】删除分类:删除的分类如果已经使用过,清空已经使用的记录,修改时需要重新选择, | 
				
			||||
 | 
					     * @param formDTO | 
				
			||||
 | 
					     * @return | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @PostMapping("delete") | 
				
			||||
 | 
					    public Result delete(@LoginUser TokenDto tokenDto, @RequestBody UpdateStyleCategoryFormDTO formDTO){ | 
				
			||||
 | 
					        formDTO.setUserId(tokenDto.getUserId()); | 
				
			||||
 | 
					        ValidatorUtils.validateEntity(formDTO,UpdateStyleCategoryFormDTO.DeleteInternalGroup.class); | 
				
			||||
 | 
					        icPartymemberStyleCategoryDictService.delete(formDTO); | 
				
			||||
 | 
					        return new Result(); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 【党员风采分类】启用或禁用 | 
				
			||||
 | 
					     * @param tokenDto | 
				
			||||
 | 
					     * @param formDTO | 
				
			||||
 | 
					     * @return | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @PostMapping("updatestatus") | 
				
			||||
 | 
					    public Result updateStatus(@LoginUser TokenDto tokenDto, @RequestBody UpdateStyleCategoryFormDTO formDTO){ | 
				
			||||
 | 
					        formDTO.setUserId(tokenDto.getUserId()); | 
				
			||||
 | 
					        ValidatorUtils.validateEntity(formDTO,UpdateStyleCategoryFormDTO.UpdateStatusInternalGroup.class); | 
				
			||||
 | 
					        icPartymemberStyleCategoryDictService.updateStatus(formDTO); | 
				
			||||
 | 
					        return new Result(); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,20 @@ | 
				
			|||||
 | 
					package com.epmet.modules.partymember.dao; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.epmet.commons.mybatis.dao.BaseDao; | 
				
			||||
 | 
					import com.epmet.modules.partymember.entity.IcPartymemberStyleCategoryDictEntity; | 
				
			||||
 | 
					import org.apache.ibatis.annotations.Mapper; | 
				
			||||
 | 
					import org.apache.ibatis.annotations.Param; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 党员风采分类字典表 | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author generator generator@elink-cn.com | 
				
			||||
 | 
					 * @since v1.0.0 2022-02-12 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@Mapper | 
				
			||||
 | 
					public interface IcPartymemberStyleCategoryDictDao extends BaseDao<IcPartymemberStyleCategoryDictEntity> { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    Integer getMaxCategoryCode(String customerId); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    int updateToDel(@Param("categoryId") String categoryId,@Param("userId") String userId); | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,66 @@ | 
				
			|||||
 | 
					package com.epmet.modules.partymember.entity; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.baomidou.mybatisplus.annotation.TableName; | 
				
			||||
 | 
					import com.epmet.commons.mybatis.entity.BaseEpmetEntity; | 
				
			||||
 | 
					import lombok.Data; | 
				
			||||
 | 
					import lombok.EqualsAndHashCode; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 党员风采分类字典表 | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author generator generator@elink-cn.com | 
				
			||||
 | 
					 * @since v1.0.0 2022-02-12 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@Data | 
				
			||||
 | 
					@EqualsAndHashCode(callSuper=false) | 
				
			||||
 | 
					@TableName("ic_partymember_style_category_dict") | 
				
			||||
 | 
					public class IcPartymemberStyleCategoryDictEntity extends BaseEpmetEntity { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						private static final long serialVersionUID = 1L; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 客户id | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String customerId; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 上级分类ID 顶级此列存储0 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String pid; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 所有上级分类ID英文顿号隔开,顶级此列存储0 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String pids; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 分类编码,分类编码+customer_id唯一;从1000开始 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String categoryCode; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 上级分类编码 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String parentCategoryCode; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 分类名称 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private String categoryName; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 分类级别1,2,3,4.... 目前只有一级 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private Integer level; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 排序 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private Integer sort; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 0:可用;1:被禁用。默认0 | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
						private Boolean beDisabled; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,47 @@ | 
				
			|||||
 | 
					package com.epmet.modules.partymember.service; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.epmet.commons.mybatis.service.BaseService; | 
				
			||||
 | 
					import com.epmet.commons.tools.page.PageData; | 
				
			||||
 | 
					import com.epmet.dto.IcPartymemberStyleCategoryDictDTO; | 
				
			||||
 | 
					import com.epmet.modules.partymember.entity.IcPartymemberStyleCategoryDictEntity; | 
				
			||||
 | 
					import com.epmet.resi.partymember.dto.partymember.form.AddStyleCategoryFormDTO; | 
				
			||||
 | 
					import com.epmet.resi.partymember.dto.partymember.form.UpdateStyleCategoryFormDTO; | 
				
			||||
 | 
					import com.epmet.resi.partymember.dto.partymember.result.StyleCategoryDictResDTO; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import java.util.List; | 
				
			||||
 | 
					import java.util.Map; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 党员风采分类字典表 | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author generator generator@elink-cn.com | 
				
			||||
 | 
					 * @since v1.0.0 2022-02-12 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					public interface IcPartymemberStyleCategoryDictService extends BaseService<IcPartymemberStyleCategoryDictEntity> { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 【党员风采分类】列表查询 | 
				
			||||
 | 
					     * @param customerId | 
				
			||||
 | 
					     * @return | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    List<StyleCategoryDictResDTO> queryList(String customerId); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 党员风采分类】添加或修改分类 | 
				
			||||
 | 
					     * @param formDTO | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    void addOrUpdate(AddStyleCategoryFormDTO formDTO); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 删除的分类如果已经使用过,清空已经使用的记录,修改时需要重新选择, | 
				
			||||
 | 
					     * @param formDTO | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    void delete(UpdateStyleCategoryFormDTO formDTO); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 【党员风采分类】启用或禁用 | 
				
			||||
 | 
					     * 新增党员风采时不显示已经禁用的分类,已经使用了禁用的分类正常显示, | 
				
			||||
 | 
					     * @param formDTO | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    void updateStatus(UpdateStyleCategoryFormDTO formDTO); | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,138 @@ | 
				
			|||||
 | 
					package com.epmet.modules.partymember.service.impl; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
				
			||||
 | 
					import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 
				
			||||
 | 
					import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			||||
 | 
					import com.epmet.commons.tools.constant.NumConstant; | 
				
			||||
 | 
					import com.epmet.commons.tools.exception.EpmetErrorCode; | 
				
			||||
 | 
					import com.epmet.commons.tools.exception.EpmetException; | 
				
			||||
 | 
					import com.epmet.modules.partymember.dao.IcPartymemberStyleCategoryDictDao; | 
				
			||||
 | 
					import com.epmet.modules.partymember.dao.IcPartymemberStyleDao; | 
				
			||||
 | 
					import com.epmet.modules.partymember.entity.IcPartymemberStyleCategoryDictEntity; | 
				
			||||
 | 
					import com.epmet.modules.partymember.service.IcPartymemberStyleCategoryDictService; | 
				
			||||
 | 
					import com.epmet.resi.partymember.dto.partymember.form.AddStyleCategoryFormDTO; | 
				
			||||
 | 
					import com.epmet.resi.partymember.dto.partymember.form.UpdateStyleCategoryFormDTO; | 
				
			||||
 | 
					import com.epmet.resi.partymember.dto.partymember.result.StyleCategoryDictResDTO; | 
				
			||||
 | 
					import org.apache.commons.lang3.StringUtils; | 
				
			||||
 | 
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
 | 
					import org.springframework.stereotype.Service; | 
				
			||||
 | 
					import org.springframework.transaction.annotation.Transactional; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import java.util.ArrayList; | 
				
			||||
 | 
					import java.util.Date; | 
				
			||||
 | 
					import java.util.List; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * 党员风采分类字典表 | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author generator generator@elink-cn.com | 
				
			||||
 | 
					 * @since v1.0.0 2022-02-12 | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					@Service | 
				
			||||
 | 
					public class IcPartymemberStyleCategoryDictServiceImpl extends BaseServiceImpl<IcPartymemberStyleCategoryDictDao, IcPartymemberStyleCategoryDictEntity> implements IcPartymemberStyleCategoryDictService { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @Autowired | 
				
			||||
 | 
					    private IcPartymemberStyleDao icPartymemberStyleDao; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 【党员风采分类】列表查询 | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @param customerId | 
				
			||||
 | 
					     * @return | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @Override | 
				
			||||
 | 
					    public List<StyleCategoryDictResDTO> queryList(String customerId) { | 
				
			||||
 | 
					        LambdaQueryWrapper<IcPartymemberStyleCategoryDictEntity> queryWrapper = new LambdaQueryWrapper<>(); | 
				
			||||
 | 
					        queryWrapper.eq(IcPartymemberStyleCategoryDictEntity::getCustomerId, customerId); | 
				
			||||
 | 
					        queryWrapper.orderByDesc(IcPartymemberStyleCategoryDictEntity::getSort); | 
				
			||||
 | 
					        List<IcPartymemberStyleCategoryDictEntity> list = baseDao.selectList(queryWrapper); | 
				
			||||
 | 
					        List<StyleCategoryDictResDTO> resultList = new ArrayList<>(); | 
				
			||||
 | 
					        for (IcPartymemberStyleCategoryDictEntity entity : list) { | 
				
			||||
 | 
					            StyleCategoryDictResDTO resDTO = new StyleCategoryDictResDTO(); | 
				
			||||
 | 
					            resDTO.setCategoryId(entity.getId()); | 
				
			||||
 | 
					            resDTO.setCategoryName(entity.getCategoryName()); | 
				
			||||
 | 
					            resDTO.setBeDisabled(entity.getBeDisabled()); | 
				
			||||
 | 
					            resultList.add(resDTO); | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					        return resultList; | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 党员风采分类】添加或修改分类 | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @param formDTO | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			||||
 | 
					    @Override | 
				
			||||
 | 
					    public void addOrUpdate(AddStyleCategoryFormDTO formDTO) { | 
				
			||||
 | 
					        //校验分类名称是否唯一
 | 
				
			||||
 | 
					        LambdaQueryWrapper<IcPartymemberStyleCategoryDictEntity> queryWrapper = new LambdaQueryWrapper<>(); | 
				
			||||
 | 
					        queryWrapper.eq(IcPartymemberStyleCategoryDictEntity::getCustomerId, formDTO.getCustomerId()) | 
				
			||||
 | 
					                .eq(IcPartymemberStyleCategoryDictEntity::getCategoryName, formDTO.getCategoryName()) | 
				
			||||
 | 
					                .ne(StringUtils.isNotBlank(formDTO.getCategoryId()), IcPartymemberStyleCategoryDictEntity::getId, formDTO.getCategoryId()); | 
				
			||||
 | 
					        Integer cout = baseDao.selectCount(queryWrapper); | 
				
			||||
 | 
					        if (cout > NumConstant.ZERO) { | 
				
			||||
 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "分类名称已存在", "分类名称已存在"); | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					        if (StringUtils.isNotBlank(formDTO.getCategoryId())) { | 
				
			||||
 | 
					            //更新分类名称
 | 
				
			||||
 | 
					            LambdaUpdateWrapper<IcPartymemberStyleCategoryDictEntity> updateWrapper = new LambdaUpdateWrapper<>(); | 
				
			||||
 | 
					            updateWrapper.set(IcPartymemberStyleCategoryDictEntity::getCategoryName, formDTO.getCategoryName()); | 
				
			||||
 | 
					            updateWrapper.eq(IcPartymemberStyleCategoryDictEntity::getId, formDTO.getCategoryId()); | 
				
			||||
 | 
					            baseDao.update(null, updateWrapper); | 
				
			||||
 | 
					            return; | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					        IcPartymemberStyleCategoryDictEntity insert = new IcPartymemberStyleCategoryDictEntity(); | 
				
			||||
 | 
					        insert.setCategoryName(formDTO.getCategoryName()); | 
				
			||||
 | 
					        insert.setCustomerId(formDTO.getCustomerId()); | 
				
			||||
 | 
					        insert.setPid(NumConstant.ZERO_STR); | 
				
			||||
 | 
					        insert.setPids(NumConstant.ZERO_STR); | 
				
			||||
 | 
					        // 查询 当前客户下最大的一级分类数。
 | 
				
			||||
 | 
					        Integer maxCategoryCode = baseDao.getMaxCategoryCode(formDTO.getCustomerId()); | 
				
			||||
 | 
					        if (NumConstant.ZERO == maxCategoryCode) { | 
				
			||||
 | 
					            maxCategoryCode = 1001; | 
				
			||||
 | 
					        } else { | 
				
			||||
 | 
					            maxCategoryCode++; | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					        insert.setCategoryCode(String.valueOf(maxCategoryCode)); | 
				
			||||
 | 
					        insert.setParentCategoryCode(NumConstant.ZERO_STR); | 
				
			||||
 | 
					        insert.setLevel(NumConstant.ONE); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        LambdaQueryWrapper<IcPartymemberStyleCategoryDictEntity> maxSortWrapper = new LambdaQueryWrapper<>(); | 
				
			||||
 | 
					        maxSortWrapper.eq(IcPartymemberStyleCategoryDictEntity::getCustomerId, formDTO.getCustomerId()) | 
				
			||||
 | 
					                .orderByDesc(IcPartymemberStyleCategoryDictEntity::getSort).last("limit 1"); | 
				
			||||
 | 
					        IcPartymemberStyleCategoryDictEntity max = baseDao.selectOne(maxSortWrapper); | 
				
			||||
 | 
					        insert.setSort(null == max ? NumConstant.ONE : max.getSort() + NumConstant.ONE); | 
				
			||||
 | 
					        insert.setBeDisabled(false); | 
				
			||||
 | 
					        baseDao.insert(insert); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 删除的分类如果已经使用过,清空已经使用的记录,修改时需要重新选择, | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @param formDTO | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			||||
 | 
					    @Override | 
				
			||||
 | 
					    public void delete(UpdateStyleCategoryFormDTO formDTO) { | 
				
			||||
 | 
					        baseDao.updateToDel(formDTO.getCategoryId(),formDTO.getUserId()); | 
				
			||||
 | 
					        icPartymemberStyleDao.clearCategry(formDTO.getCategoryId(),formDTO.getUserId()); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * 【党员风采分类】启用或禁用 | 
				
			||||
 | 
					     * 新增党员风采时不显示已经禁用的分类,已经使用了禁用的分类正常显示, | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @param formDTO | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    @Override | 
				
			||||
 | 
					    public void updateStatus(UpdateStyleCategoryFormDTO formDTO) { | 
				
			||||
 | 
					        LambdaUpdateWrapper<IcPartymemberStyleCategoryDictEntity> updateWrapper = new LambdaUpdateWrapper<>(); | 
				
			||||
 | 
					        updateWrapper.set(IcPartymemberStyleCategoryDictEntity::getBeDisabled, formDTO.getBeDisabled()) | 
				
			||||
 | 
					                .set(IcPartymemberStyleCategoryDictEntity::getUpdatedBy, formDTO.getUserId()) | 
				
			||||
 | 
					                .set(IcPartymemberStyleCategoryDictEntity::getUpdatedTime, new Date()); | 
				
			||||
 | 
					        updateWrapper.eq(IcPartymemberStyleCategoryDictEntity::getId, formDTO.getCategoryId()); | 
				
			||||
 | 
					        baseDao.update(null, updateWrapper); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,23 @@ | 
				
			|||||
 | 
					CREATE TABLE `ic_partymember_style_category_dict` ( | 
				
			||||
 | 
					  `ID` varchar(64) NOT NULL COMMENT '楼栋主键', | 
				
			||||
 | 
					  `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', | 
				
			||||
 | 
					  `PID` varchar(64) CHARACTER SET utf8 NOT NULL COMMENT '上级分类ID 顶级此列存储0', | 
				
			||||
 | 
					  `PIDS` varchar(512) CHARACTER SET utf8 NOT NULL COMMENT '所有上级分类ID英文顿号隔开,顶级此列存储0', | 
				
			||||
 | 
					  `CATEGORY_CODE` varchar(64) CHARACTER SET utf8 NOT NULL COMMENT '分类编码,分类编码+customer_id唯一;从1000开始', | 
				
			||||
 | 
					  `PARENT_CATEGORY_CODE` varchar(64) CHARACTER SET utf8 NOT NULL COMMENT '上级分类编码', | 
				
			||||
 | 
					  `CATEGORY_NAME` varchar(128) CHARACTER SET utf8 NOT NULL COMMENT '分类名称', | 
				
			||||
 | 
					  `LEVEL` int(10) NOT NULL COMMENT '分类级别1,2,3,4.... 目前只有一级', | 
				
			||||
 | 
					  `SORT` int(10) unsigned NOT NULL COMMENT '排序', | 
				
			||||
 | 
					  `BE_DISABLED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:可用;1:被禁用。默认0', | 
				
			||||
 | 
					  `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除、1已删除', | 
				
			||||
 | 
					  `REVISION` int(11) NOT NULL DEFAULT '0' COMMENT '乐观锁', | 
				
			||||
 | 
					  `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', | 
				
			||||
 | 
					  `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', | 
				
			||||
 | 
					  `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', | 
				
			||||
 | 
					  `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', | 
				
			||||
 | 
					  PRIMARY KEY (`ID`) | 
				
			||||
 | 
					) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='党员风采分类字典表'; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					alter table ic_partymember_style add COLUMN CATEGORY_ID VARCHAR(64) comment '分类主键' AFTER  MAIN_DEED; | 
				
			||||
 | 
					alter table ic_partymember_style add COLUMN CATEGORY_CODE VARCHAR(64) comment '分类编码' after CATEGORY_ID; | 
				
			||||
@ -0,0 +1,18 @@ | 
				
			|||||
 | 
					<?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.epmet.modules.partymember.dao.IcPartymemberStyleCategoryDictDao"> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    <select id="getMaxCategoryCode" parameterType="java.lang.String" resultType="java.lang.Integer"> | 
				
			||||
 | 
					        SELECT | 
				
			||||
 | 
					            IFNULL( MAX(CATEGORY_CODE), 0) | 
				
			||||
 | 
					        FROM | 
				
			||||
 | 
					            ic_partymember_style_category_dict | 
				
			||||
 | 
					        WHERE CUSTOMER_ID = #{customerId} | 
				
			||||
 | 
					    </select> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    <update id="updateToDel" parameterType="map"> | 
				
			||||
 | 
					        update ic_partymember_style_category_dict set del_flag='1',UPDATED_BY=#{userId},UPDATED_TIME=now() | 
				
			||||
 | 
					        where id=#{categoryId} | 
				
			||||
 | 
					    </update> | 
				
			||||
 | 
					</mapper> | 
				
			||||
					Loading…
					
					
				
		Reference in new issue