| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.annotation.ValueAuth; |
| | | import com.yuanchu.mom.common.PrintChina; |
| | | import com.yuanchu.mom.dto.Custom; |
| | | import com.yuanchu.mom.dto.UserPageDto; |
| | | import com.yuanchu.mom.pojo.User; |
| | | import com.yuanchu.mom.service.CustomService; |
| | | import com.yuanchu.mom.service.PowerService; |
| | | import com.yuanchu.mom.service.UserService; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | |
| | | private PowerService powerService; |
| | | |
| | | private Jwt jwt; |
| | | |
| | | private CustomService customService; |
| | | |
| | | @ApiOperation(value = "ç»å½") |
| | | @PostMapping("/enter") |
| | |
| | | public Result<?> getUserMenu() { |
| | | return Result.success(userService.getUserMenu()); |
| | | } |
| | | |
| | | @ApiOperation(value = "è·å客æ·å表") |
| | | @PostMapping("/selectCustomPageList") |
| | | public Result selectCustomPageList(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | Custom custom = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), Custom.class); |
| | | return Result.success(customService.selectCustomPageList(page, custom)); |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤å®¢æ·ä¿¡æ¯") |
| | | @PostMapping("/delCustomById") |
| | | public Result<?> delCustomById(Integer id) { |
| | | return Result.success(customService.delCustomById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ°å¢å®¢æ·ä¿¡æ¯") |
| | | @PostMapping("/addCustom") |
| | | public Result<?> addCustom(@RequestBody Custom custom) { |
| | | return Result.success(customService.addCustom(custom)); |
| | | } |
| | | |
| | | } |
| | |
| | | private Integer id; |
| | | |
| | | @ValueTableShow(2) |
| | | @ApiModelProperty(value = "è´¦å·") |
| | | @ApiModelProperty(value = "客æ·è´¦å·") |
| | | private String account; |
| | | |
| | | @ValueTableShow(1) |
| | | @ApiModelProperty(value = "ç¨æ·å") |
| | | @ApiModelProperty(value = "客æ·åç§°") |
| | | private String name; |
| | | |
| | | @ValueTableShow(10) |
| | | @ApiModelProperty(value = "ç¶æ") |
| | | @ValueTableShow(9) |
| | | @ApiModelProperty(value = "è´¦å·ç¶æ") |
| | | private Integer state; |
| | | |
| | | @ValueTableShow(5) |
| | | @ApiModelProperty(value = "é®ç®±") |
| | | @ApiModelProperty(value = "çµåé®ç®±") |
| | | private String email; |
| | | |
| | | @ValueTableShow(6) |
| | | @ApiModelProperty(value = "çµè¯å·ç ") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "é¨é¨") |
| | | @ApiModelProperty(value = "æå¨é¨é¨") |
| | | private String department; |
| | | |
| | | @ValueTableShow(7) |
| | |
| | | @ApiModelProperty(value = "åä½å°å") |
| | | private String address; |
| | | |
| | | @ValueTableShow(9) |
| | | @ApiModelProperty(value = "åå»ºæ¥æ") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "æ´æ°æ¥æ") |
| | | @ValueTableShow(9) |
| | | @ApiModelProperty(value = "åå»ºæ¥æ") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ValueTableShow(10) |
| | | @ApiModelProperty(value = "åå»ºç¨æ·") |
| | | private String updateUserName; |
| | | |
| | | private Integer isCustom; |
| | | |
| | | } |
| | |
| | | @Repository |
| | | public interface CustomMapper extends BaseMapper<Custom> { |
| | | |
| | | // IPage<User> selectUserDtoPageList(IPage<UserPageDto> page, QueryWrapper<UserPageDto> ew); |
| | | IPage<Custom> selectCustomPageList(IPage<Custom> page, QueryWrapper<Custom> ew); |
| | | |
| | | int delCustomById(Integer id); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.mom.dto.Custom; |
| | | import com.yuanchu.mom.dto.UserPageDto; |
| | | import com.yuanchu.mom.pojo.Power; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @description é对表ãuser(ç¨æ·id)ãçæ°æ®åºæä½Service |
| | | * @createDate 2024å¹´3æ7æ¥09:21:59 |
| | | */ |
| | | public interface CustomService extends IService<Custom> { |
| | | |
| | | Map<String, Object> selectCustomPageList(IPage<Custom> page, Custom custom); |
| | | |
| | | int delCustomById(Integer id); |
| | | |
| | | int addCustom(Custom custom); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.common.GetLook; |
| | | import com.yuanchu.mom.common.PrintChina; |
| | | import com.yuanchu.mom.dto.Custom; |
| | | import com.yuanchu.mom.dto.UserPageDto; |
| | | import com.yuanchu.mom.mapper.CustomMapper; |
| | | import com.yuanchu.mom.mapper.PowerMapper; |
| | | import com.yuanchu.mom.mapper.UserMapper; |
| | | import com.yuanchu.mom.pojo.Power; |
| | | import com.yuanchu.mom.service.CustomService; |
| | | import com.yuanchu.mom.service.PowerService; |
| | | import com.yuanchu.mom.utils.QueryWrappers; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author Administrator |
| | | * @description é对表ãpower(ç¨æ·id)ãçæ°æ®åºæä½Serviceå®ç° |
| | | * @createDate 2023-12-27 02:37:38 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> |
| | | implements CustomService { |
| | | |
| | | private CustomMapper customMapper; |
| | | |
| | | private GetLook getLook; |
| | | |
| | | @Override |
| | | public Map<String, Object> selectCustomPageList(IPage<Custom> page, Custom custom) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("head", PrintChina.printChina(Custom.class)); |
| | | Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectCustomPageList"); |
| | | if(map1.get("look")==1) custom.setCreateUser(map1.get("userId")); |
| | | map.put("body", customMapper.selectCustomPageList(page, QueryWrappers.queryWrappers(custom))); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public int delCustomById(Integer id) { |
| | | return customMapper.delCustomById(id); |
| | | } |
| | | |
| | | @Override |
| | | public int addCustom(Custom custom) { |
| | | custom.setIsCustom(1); |
| | | return customMapper.updateById(custom); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.yuanchu.mom.mapper.CustomMapper"> |
| | | <update id="delCustomById"> |
| | | update user set is_custom = 0 |
| | | where id = #{id} |
| | | </update> |
| | | <select id="selectCustomPageList" resultType="com.yuanchu.mom.dto.Custom"> |
| | | select * from ( |
| | | select u1.id, u1.account, u1.name, u1.state, u1.update_time, u1.update_user, u1.age, u1.email, u1.phone, u1.department, u1.company, u1.address, u2.name update_user_name |
| | | from user u1 |
| | | left join user u2 on u2.id = u1.update_user |
| | | where u1.is_custom = 1 |
| | | ) a |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | <mapper namespace="com.yuanchu.mom.mapper.UserMapper"> |
| | | <select id="selectUserDtoPageList" resultType="com.yuanchu.mom.dto.UserPageDto"> |
| | | select * from ( |
| | | select u1.id, u1.account, u1.name, u1.state, u1.create_time, u1.update_time, u1.create_user, u1.update_user, u1.age, u1.email, u1.phone, u1.department, u1.company, u1.role_id, u2.name create_user_name, u3.name update_user_name, r.name role_name |
| | | select u1.id, u1.account, u1.name, u1.state, u1.create_time, u1.update_time, u1.create_user, u1.update_user, u1.age, u1.email, u1.phone, u1.department, u1.company, u1.address, u1.is_custom, u1.role_id, u2.name create_user_name, u3.name update_user_name, r.name role_name |
| | | from user u1 |
| | | left join user u2 on u2.id = u1.create_user |
| | | left join user u3 on u3.id = u1.update_user |