| | |
| | | // generator.username="sa"; |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="man_loc_area"; |
| | | generator.tableDesc="loc areas"; |
| | | generator.table="man_loc_area_rela"; |
| | | generator.tableDesc="loc areas rela"; |
| | | generator.packagePath="com.vincent.rsf.server.manager"; |
| | | |
| | | generator.build(); |
New file |
| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.LocAreaRela; |
| | | import com.vincent.rsf.server.manager.service.LocAreaRelaService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class LocAreaRelaController extends BaseController { |
| | | |
| | | @Autowired |
| | | private LocAreaRelaService locAreaRelaService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaRela:list')") |
| | | @PostMapping("/locAreaRela/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<LocAreaRela, BaseParam> pageParam = new PageParam<>(baseParam, LocAreaRela.class); |
| | | return R.ok().add(locAreaRelaService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaRela:list')") |
| | | @PostMapping("/locAreaRela/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(locAreaRelaService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaRela:list')") |
| | | @PostMapping({"/locAreaRela/many/{ids}", "/locAreaRelas/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(locAreaRelaService.listByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaRela:list')") |
| | | @GetMapping("/locAreaRela/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(locAreaRelaService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaRela:save')") |
| | | @OperationLog("Create loc areas rela") |
| | | @PostMapping("/locAreaRela/save") |
| | | public R save(@RequestBody LocAreaRela locAreaRela) { |
| | | locAreaRela.setCreateBy(getLoginUserId()); |
| | | locAreaRela.setCreateTime(new Date()); |
| | | locAreaRela.setUpdateBy(getLoginUserId()); |
| | | locAreaRela.setUpdateTime(new Date()); |
| | | if (!locAreaRelaService.save(locAreaRela)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(locAreaRela); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaRela:update')") |
| | | @OperationLog("Update loc areas rela") |
| | | @PostMapping("/locAreaRela/update") |
| | | public R update(@RequestBody LocAreaRela locAreaRela) { |
| | | locAreaRela.setUpdateBy(getLoginUserId()); |
| | | locAreaRela.setUpdateTime(new Date()); |
| | | if (!locAreaRelaService.updateById(locAreaRela)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(locAreaRela); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaRela:remove')") |
| | | @OperationLog("Delete loc areas rela") |
| | | @PostMapping("/locAreaRela/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!locAreaRelaService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaRela:list')") |
| | | @PostMapping("/locAreaRela/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<LocAreaRela> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(LocAreaRela::getLocAreaId, condition); |
| | | } |
| | | locAreaRelaService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getLocAreaId())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaRela:list')") |
| | | @PostMapping("/locAreaRela/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(locAreaRelaService.list(), LocAreaRela.class), response); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.SpringUtils; |
| | | import com.vincent.rsf.server.system.service.UserService; |
| | | import com.vincent.rsf.server.system.entity.User; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("man_loc_area_rela") |
| | | public class LocAreaRela implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 分区ID |
| | | */ |
| | | @ApiModelProperty(value= "分区ID") |
| | | private Long locAreaId; |
| | | |
| | | /** |
| | | * 库位ID |
| | | */ |
| | | @ApiModelProperty(value= "库位ID") |
| | | private Long locId; |
| | | |
| | | /** |
| | | * 状态 1: 正常 0: 冻结 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 冻结 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | | * 租户 |
| | | */ |
| | | @ApiModelProperty(value= "租户") |
| | | private Integer tenantId; |
| | | |
| | | /** |
| | | * 添加人员 |
| | | */ |
| | | @ApiModelProperty(value= "添加人员") |
| | | private Long createBy; |
| | | |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value= "添加时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | private Long updateBy; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | public LocAreaRela() {} |
| | | |
| | | public LocAreaRela(Long locAreaId,Long locId,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { |
| | | this.locAreaId = locAreaId; |
| | | this.locId = locId; |
| | | this.status = status; |
| | | this.deleted = deleted; |
| | | this.tenantId = tenantId; |
| | | this.createBy = createBy; |
| | | this.createTime = createTime; |
| | | this.updateBy = updateBy; |
| | | this.updateTime = updateTime; |
| | | this.memo = memo; |
| | | } |
| | | |
| | | // LocAreaRela locAreaRela = new LocAreaRela( |
| | | // null, // 分区ID |
| | | // null, // 库位ID |
| | | // null, // 状态[非空] |
| | | // null, // 是否删除[非空] |
| | | // null, // 租户 |
| | | // null, // 添加人员 |
| | | // null, // 添加时间[非空] |
| | | // null, // 修改人员 |
| | | // null, // 修改时间[非空] |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "正常"; |
| | | case 0: |
| | | return "冻结"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | } |
| | | } |
| | | |
| | | public String getCreateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.createBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getCreateTime$(){ |
| | | if (Cools.isEmpty(this.createTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getUpdateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.updateBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getUpdateTime$(){ |
| | | if (Cools.isEmpty(this.updateTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); |
| | | } |
| | | |
| | | |
| | | |
| | | public Boolean getStatusBool(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return true; |
| | | case 0: |
| | | return false; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.mapper; |
| | | |
| | | import com.vincent.rsf.server.manager.entity.LocAreaRela; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface LocAreaRelaMapper extends BaseMapper<LocAreaRela> { |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.server.manager.entity.LocAreaRela; |
| | | |
| | | public interface LocAreaRelaService extends IService<LocAreaRela> { |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.vincent.rsf.server.manager.mapper.LocAreaRelaMapper; |
| | | import com.vincent.rsf.server.manager.entity.LocAreaRela; |
| | | import com.vincent.rsf.server.manager.service.LocAreaRelaService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("locAreaRelaService") |
| | | public class LocAreaRelaServiceImpl extends ServiceImpl<LocAreaRelaMapper, LocAreaRela> implements LocAreaRelaService { |
| | | |
| | | } |
New file |
| | |
| | | -- save locAreaRela record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `tenant_id`, `status`) values ( 'menu.locAreaRela', '0', '/manager/locAreaRela', 'locAreaRela', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Query loc areas rela', '', '1', 'manager:locAreaRela:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Create loc areas rela', '', '1', 'manager:locAreaRela:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Update loc areas rela', '', '1', 'manager:locAreaRela:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Delete loc areas rela', '', '1', 'manager:locAreaRela:remove', '3', '1', '1'); |
| | | |
| | | -- locale menu name |
| | | locAreaRela: 'LocAreaRela', |
| | | |
| | | -- locale field |
| | | locAreaRela: { |
| | | locAreaId: "locAreaId", |
| | | locId: "locId", |
| | | }, |
| | | |
| | | -- ResourceContent |
| | | import locAreaRela from './locAreaRela'; |
| | | |
| | | case 'locAreaRela': |
| | | return locAreaRela; |
New file |
| | |
| | | <?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.vincent.rsf.server.manager.mapper.LocAreaRelaMapper"> |
| | | |
| | | </mapper> |