| | |
| | | // generator.username="sa"; |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="man_loc_area_mat_rela"; |
| | | generator.tableDesc="loc areas mats rela"; |
| | | generator.table="man_loc_area_mat"; |
| | | generator.tableDesc="loc areas mats"; |
| | | generator.packagePath="com.vincent.rsf.server.test"; |
| | | |
| | | 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.LocAreaMat; |
| | | import com.vincent.rsf.server.manager.service.LocAreaMatService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import io.swagger.annotations.Api; |
| | | 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.*; |
| | | |
| | | @Api(tags = "逻辑分区") |
| | | @RestController |
| | | public class LocAreaMatController extends BaseController { |
| | | |
| | | @Autowired |
| | | private LocAreaMatService locAreaMatService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMat:list')") |
| | | @PostMapping("/locAreaMat/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<LocAreaMat, BaseParam> pageParam = new PageParam<>(baseParam, LocAreaMat.class); |
| | | return R.ok().add(locAreaMatService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMat:list')") |
| | | @PostMapping("/locAreaMat/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(locAreaMatService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMat:list')") |
| | | @PostMapping({"/locAreaMat/many/{ids}", "/locAreaMats/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(locAreaMatService.listByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMat:list')") |
| | | @GetMapping("/locAreaMat/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(locAreaMatService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMat:save')") |
| | | @OperationLog("Create loc areas mats") |
| | | @PostMapping("/locAreaMat/save") |
| | | public R save(@RequestBody LocAreaMat locAreaMat) { |
| | | locAreaMat.setCreateBy(getLoginUserId()); |
| | | locAreaMat.setCreateTime(new Date()); |
| | | locAreaMat.setUpdateBy(getLoginUserId()); |
| | | locAreaMat.setUpdateTime(new Date()); |
| | | if (!locAreaMatService.save(locAreaMat)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(locAreaMat); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMat:update')") |
| | | @OperationLog("Update loc areas mats") |
| | | @PostMapping("/locAreaMat/update") |
| | | public R update(@RequestBody LocAreaMat locAreaMat) { |
| | | locAreaMat.setUpdateBy(getLoginUserId()); |
| | | locAreaMat.setUpdateTime(new Date()); |
| | | if (!locAreaMatService.updateById(locAreaMat)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(locAreaMat); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMat:remove')") |
| | | @OperationLog("Delete loc areas mats") |
| | | @PostMapping("/locAreaMat/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!locAreaMatService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMat:list')") |
| | | @PostMapping("/locAreaMat/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<LocAreaMat> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(LocAreaMat::getId, condition); |
| | | } |
| | | locAreaMatService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getId())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMat:list')") |
| | | @PostMapping("/locAreaMat/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(locAreaMatService.list(), LocAreaMat.class), response); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.entity; |
| | | |
| | | 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 com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.SpringUtils; |
| | | import com.vincent.rsf.server.manager.service.WarehouseAreasService; |
| | | import com.vincent.rsf.server.manager.service.WarehouseService; |
| | | import com.vincent.rsf.server.system.entity.User; |
| | | import com.vincent.rsf.server.system.service.UserService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("man_loc_area_mat") |
| | | public class LocAreaMat implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 逻辑编号 |
| | | */ |
| | | @ApiModelProperty(value= "逻辑编号") |
| | | private String code; |
| | | |
| | | /** |
| | | * 仓库ID(*) |
| | | */ |
| | | @ApiModelProperty(value= "仓库ID(*)") |
| | | private Long warehouseId; |
| | | |
| | | /** |
| | | * 库区ID(*) |
| | | */ |
| | | @ApiModelProperty(value= "库区ID(*)") |
| | | private Long areaId; |
| | | |
| | | /** |
| | | * 逻辑描述 |
| | | */ |
| | | @ApiModelProperty(value= "逻辑描述") |
| | | private String depict; |
| | | |
| | | /** |
| | | * 状态 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 LocAreaMat() {} |
| | | |
| | | public LocAreaMat(String code, Long warehouseId, Long areaId, String depict, Integer status, Integer deleted, Integer tenantId, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo) { |
| | | this.code = code; |
| | | this.warehouseId = warehouseId; |
| | | this.areaId = areaId; |
| | | this.depict = depict; |
| | | this.status = status; |
| | | this.deleted = deleted; |
| | | this.tenantId = tenantId; |
| | | this.createBy = createBy; |
| | | this.createTime = createTime; |
| | | this.updateBy = updateBy; |
| | | this.updateTime = updateTime; |
| | | this.memo = memo; |
| | | } |
| | | |
| | | // LocAreaMat locAreaMat = new LocAreaMat( |
| | | // null, // 逻辑编号 |
| | | // null, // 仓库ID(*) |
| | | // null, // 库区ID(*) |
| | | // null, // 逻辑描述 |
| | | // null, // 状态[非空] |
| | | // null, // 是否删除[非空] |
| | | // null, // 租户 |
| | | // null, // 添加人员 |
| | | // null, // 添加时间[非空] |
| | | // null, // 修改人员 |
| | | // null, // 修改时间[非空] |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public String getWarehouseId$(){ |
| | | WarehouseService service = SpringUtils.getBean(WarehouseService.class); |
| | | Warehouse warehouse = service.getById(this.warehouseId); |
| | | if (!Cools.isEmpty(warehouse)){ |
| | | return String.valueOf(warehouse.getName()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getAreaId$(){ |
| | | WarehouseAreasService service = SpringUtils.getBean(WarehouseAreasService.class); |
| | | WarehouseAreas warehouseArea = service.getById(this.areaId); |
| | | if (!Cools.isEmpty(warehouseArea)){ |
| | | return String.valueOf(warehouseArea.getName()); |
| | | } |
| | | return 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.LocAreaMat; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface LocAreaMatMapper extends BaseMapper<LocAreaMat> { |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.server.manager.entity.LocAreaMat; |
| | | |
| | | public interface LocAreaMatService extends IService<LocAreaMat> { |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.vincent.rsf.server.manager.mapper.LocAreaMatMapper; |
| | | import com.vincent.rsf.server.manager.entity.LocAreaMat; |
| | | import com.vincent.rsf.server.manager.service.LocAreaMatService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("locAreaMatService") |
| | | public class LocAreaMatServiceImpl extends ServiceImpl<LocAreaMatMapper, LocAreaMat> implements LocAreaMatService { |
| | | |
| | | } |
New file |
| | |
| | | -- save locAreaMat record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `tenant_id`, `status`) values ( 'menu.locAreaMat', '0', '/test/locAreaMat', 'locAreaMat', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Query loc areas mats', '195', '1', 'test:locAreaMat:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Create loc areas mats', '195', '1', 'test:locAreaMat:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Update loc areas mats', '195', '1', 'test:locAreaMat:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Delete loc areas mats', '195', '1', 'test:locAreaMat:remove', '3', '1', '1'); |
| | | |
| | | -- locale menu name |
| | | locAreaMat: 'LocAreaMat', |
| | | |
| | | -- locale field |
| | | locAreaMat: { |
| | | code: "code", |
| | | depict: "depict", |
| | | }, |
| | | |
| | | -- ResourceContent |
| | | import locAreaMat from './locAreaMat'; |
| | | |
| | | case 'locAreaMat': |
| | | return locAreaMat; |
| | |
| | | matching-strategy: ANT_PATH_MATCHER |
| | | datasource: |
| | | driver-class-name: com.mysql.jdbc.Driver |
| | | # url: jdbc:mysql://192.168.4.24:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | # username: root |
| | | url: jdbc:mysql://47.76.147.249:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: rsf |
| | | url: jdbc:mysql://192.168.4.24:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | # url: jdbc:mysql://47.76.147.249:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | # username: rsf |
| | | password: 34821015 |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | druid: |
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.LocAreaMatMapper"> |
| | | |
| | | </mapper> |
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.test.mapper.LocAreaMatMapper"> |
| | | |
| | | </mapper> |