Browse Source

基础页面部分代码提交

develop
ljlong_2630 12 months ago
parent
commit
400896cd17
  1. 22
      lzbi-module/src/main/java/com/lzbi/module/base/BaseModuleEntity.java
  2. 92
      lzbi-module/src/main/java/com/lzbi/special/controller/DcBaseWorkSpecialController.java
  3. 7
      lzbi-module/src/main/java/com/lzbi/special/domain/DcBaseWorkSpecial.java
  4. 22
      lzbi-module/src/main/java/com/lzbi/special/mapper/DcBaseWorkSpecialMapper.java
  5. 38
      lzbi-module/src/main/java/com/lzbi/special/service/DcBaseWorkSpecialService.java
  6. 19
      lzbi-module/src/main/resources/mapper/asset/DcBaseWorkSpecialMapper.xml

22
lzbi-module/src/main/java/com/lzbi/module/base/BaseModuleEntity.java

@ -36,6 +36,12 @@ public class BaseModuleEntity implements Serializable,Cloneable{
/** 删除时间 */
@ApiModelProperty(name = "删除时间",notes = "")
private Date deleteTime ;
/** 部门id */
@ApiModelProperty(name = "部门id",notes = "")
private Long deptId ;
/** 用户id */
@ApiModelProperty(name = "用户id",notes = "")
private Long userId ;
public String getTenantId() {
return tenantId;
@ -100,4 +106,20 @@ public class BaseModuleEntity implements Serializable,Cloneable{
public void setDeleteTime(Date deleteTime) {
this.deleteTime = deleteTime;
}
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
}

92
lzbi-module/src/main/java/com/lzbi/special/controller/DcBaseWorkSpecialController.java

@ -1,8 +1,15 @@
package com.lzbi.special.controller;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.lzbi.common.utils.DateUtils;
import com.lzbi.special.domain.DcBaseWorkSpecial;
import com.lzbi.special.service.DcBaseWorkSpecialService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@ -18,7 +25,6 @@ import com.lzbi.common.annotation.Log;
import com.lzbi.common.core.controller.BaseController;
import com.lzbi.common.core.domain.AjaxResult;
import com.lzbi.common.enums.BusinessType;
import com.lzbi.special.domain.DcBaseWorkSpecialDao;
import com.lzbi.common.utils.poi.ExcelUtil;
import com.lzbi.common.core.page.TableDataInfo;
@ -40,10 +46,10 @@ public class DcBaseWorkSpecialController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('special:specialManager:list')")
@GetMapping("/list")
public TableDataInfo list(DcBaseWorkSpecialDao dcBaseWorkSpecialDao)
public TableDataInfo list(DcBaseWorkSpecial dcBaseWorkSpecial)
{
startPage();
List<DcBaseWorkSpecialDao> list = dcBaseWorkSpecialService.selectDcBaseWorkSpecialDaoList(dcBaseWorkSpecialDao);
List<DcBaseWorkSpecial> list = dcBaseWorkSpecialService.selectDcBaseWorkSpecialDaoList(dcBaseWorkSpecial);
return getDataTable(list);
}
@ -53,10 +59,10 @@ public class DcBaseWorkSpecialController extends BaseController
@PreAuthorize("@ss.hasPermi('special:specialManager:export')")
@Log(title = "生产专业管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DcBaseWorkSpecialDao dcBaseWorkSpecialDao)
public void export(HttpServletResponse response, DcBaseWorkSpecial dcBaseWorkSpecial)
{
List<DcBaseWorkSpecialDao> list = dcBaseWorkSpecialService.selectDcBaseWorkSpecialDaoList(dcBaseWorkSpecialDao);
ExcelUtil<DcBaseWorkSpecialDao> util = new ExcelUtil<DcBaseWorkSpecialDao>(DcBaseWorkSpecialDao.class);
List<DcBaseWorkSpecial> list = dcBaseWorkSpecialService.selectDcBaseWorkSpecialDaoList(dcBaseWorkSpecial);
ExcelUtil<DcBaseWorkSpecial> util = new ExcelUtil<DcBaseWorkSpecial>(DcBaseWorkSpecial.class);
util.exportExcel(response, list, "生产专业管理数据");
}
@ -67,7 +73,7 @@ public class DcBaseWorkSpecialController extends BaseController
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(dcBaseWorkSpecialService.selectDcBaseWorkSpecialDaoById(id));
return success(dcBaseWorkSpecialService.selectDcBaseWorkSpecialById(id));
}
/**
@ -76,9 +82,9 @@ public class DcBaseWorkSpecialController extends BaseController
@PreAuthorize("@ss.hasPermi('special:specialManager:add')")
@Log(title = "生产专业管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DcBaseWorkSpecialDao dcBaseWorkSpecialDao)
public AjaxResult add(@RequestBody DcBaseWorkSpecial dcBaseWorkSpecial)
{
return toAjax(dcBaseWorkSpecialService.insertDcBaseWorkSpecialDao(dcBaseWorkSpecialDao));
return toAjax(dcBaseWorkSpecialService.insertDcBaseWorkSpecial(dcBaseWorkSpecial));
}
/**
@ -87,9 +93,9 @@ public class DcBaseWorkSpecialController extends BaseController
@PreAuthorize("@ss.hasPermi('special:specialManager:edit')")
@Log(title = "生产专业管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DcBaseWorkSpecialDao dcBaseWorkSpecialDao)
public AjaxResult edit(@RequestBody DcBaseWorkSpecial dcBaseWorkSpecial)
{
return toAjax(dcBaseWorkSpecialService.updateDcBaseWorkSpecialDao(dcBaseWorkSpecialDao));
return toAjax(dcBaseWorkSpecialService.updateDcBaseWorkSpecialDao(dcBaseWorkSpecial));
}
/**
@ -100,7 +106,7 @@ public class DcBaseWorkSpecialController extends BaseController
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(dcBaseWorkSpecialService.deleteDcBaseWorkSpecialDaoByIds(ids));
return toAjax(dcBaseWorkSpecialService.deleteDcBaseWorkSpecialByIds(ids));
}
@ -109,12 +115,70 @@ public class DcBaseWorkSpecialController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('special:specialManager:list')")
@GetMapping("/listNoPage")
public AjaxResult listNoPage(DcBaseWorkSpecialDao dcBaseWorkSpecialDao)
public AjaxResult listNoPage(DcBaseWorkSpecial dcBaseWorkSpecial)
{
List<DcBaseWorkSpecialDao> list = dcBaseWorkSpecialService.selectDcBaseWorkSpecialDaoList(dcBaseWorkSpecialDao);
List<DcBaseWorkSpecial> list = dcBaseWorkSpecialService.selectDcBaseWorkSpecialDaoList(dcBaseWorkSpecial);
return AjaxResult.success(list);
}
/**
* 新增生产专业管理
*/
@PreAuthorize("@ss.hasPermi('special:specialManager:add')")
@Log(title = "生产专业管理", businessType = BusinessType.INSERT)
@PostMapping("/addBatch")
public AjaxResult addBatch(@RequestBody JSONArray jsonArray)
{
if (jsonArray == null) {
throw new IllegalArgumentException("未能接收任何参数!");
}
List<DcBaseWorkSpecial> beanList = new ArrayList<>();
try {
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject beanObject = jsonArray.getJSONObject(i);
// 移除ID属性
beanObject.remove("id");
DcBaseWorkSpecial dcBaseWorkSpecial = JSON.toJavaObject(beanObject, DcBaseWorkSpecial.class);
dcBaseWorkSpecial.setCreatedTime(DateUtils.getNowDate());
dcBaseWorkSpecial.setDeptId(getDeptId());
dcBaseWorkSpecial.setUserId(getUserId());
dcBaseWorkSpecial.setCreatedBy(String.valueOf(getUserId()));
dcBaseWorkSpecial.setCreatedTime(DateUtils.getNowDate());
beanList.add(dcBaseWorkSpecial);
}
} catch (Exception e) {
throw new IllegalArgumentException("解析list对象异常!");
}
return toAjax(dcBaseWorkSpecialService.saveBatch(beanList));
}
/**
* 修改生产专业管理
*/
@PreAuthorize("@ss.hasPermi('special:specialManager:edit')")
@Log(title = "生产专业管理", businessType = BusinessType.UPDATE)
@PutMapping("editBatch")
public AjaxResult editBatch(@RequestBody JSONArray jsonArray)
{
if (jsonArray == null) {
throw new IllegalArgumentException("未能接收任何参数!");
}
List<DcBaseWorkSpecial> dcBaseWorkSpecialList = new ArrayList<>();
try {
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject beanObject = jsonArray.getJSONObject(i);
DcBaseWorkSpecial dcBaseWorkSpecial = JSON.toJavaObject(beanObject, DcBaseWorkSpecial.class);
dcBaseWorkSpecial.setUpdatedBy(String.valueOf(getUserId()));
dcBaseWorkSpecial.setUpdatedTime(DateUtils.getNowDate());
dcBaseWorkSpecialList.add(dcBaseWorkSpecial);
}
} catch (Exception e) {
throw new IllegalArgumentException("解析list对象异常!");
}
return toAjax(dcBaseWorkSpecialService.updateBatchById(dcBaseWorkSpecialList));
}
}

7
lzbi-module/src/main/java/com/lzbi/special/domain/DcBaseWorkSpecialDao.java → lzbi-module/src/main/java/com/lzbi/special/domain/DcBaseWorkSpecial.java

@ -1,7 +1,9 @@
package com.lzbi.special.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.lzbi.common.annotation.Excel;
@ -13,7 +15,7 @@ import com.lzbi.module.base.BaseModuleEntity;
* @author win
* @date 2023-11-28
*/
public class DcBaseWorkSpecialDao extends BaseModuleEntity
public class DcBaseWorkSpecial extends BaseModuleEntity
{
private static final long serialVersionUID = 1L;
@ -41,6 +43,7 @@ public class DcBaseWorkSpecialDao extends BaseModuleEntity
/** 删除时间 */
private Date deleteTime;
@TableId(value = "id", type = IdType.AUTO)
/** 主键 */
private Long id;

22
lzbi-module/src/main/java/com/lzbi/special/mapper/DcBaseWorkSpecialMapper.java

@ -3,7 +3,7 @@ package com.lzbi.special.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzbi.special.domain.DcBaseWorkSpecialDao;
import com.lzbi.special.domain.DcBaseWorkSpecial;
/**
@ -13,7 +13,7 @@ import com.lzbi.special.domain.DcBaseWorkSpecialDao;
* @date 2023-11-28
*/
public interface DcBaseWorkSpecialMapper extends BaseMapper<DcBaseWorkSpecialDao>
public interface DcBaseWorkSpecialMapper extends BaseMapper<DcBaseWorkSpecial>
{
/**
* 查询生产专业管理
@ -21,31 +21,31 @@ public interface DcBaseWorkSpecialMapper extends BaseMapper<DcBaseWorkSpecialDao
* @param id 生产专业管理主键
* @return 生产专业管理
*/
public DcBaseWorkSpecialDao selectDcBaseWorkSpecialDaoById(Long id);
public DcBaseWorkSpecial selectDcBaseWorkSpecialById(Long id);
/**
* 查询生产专业管理列表
*
* @param dcBaseWorkSpecialDao 生产专业管理
* @param dcBaseWorkSpecial 生产专业管理
* @return 生产专业管理集合
*/
public List<DcBaseWorkSpecialDao> selectDcBaseWorkSpecialDaoList(DcBaseWorkSpecialDao dcBaseWorkSpecialDao);
public List<DcBaseWorkSpecial> selectDcBaseWorkSpecialList(DcBaseWorkSpecial dcBaseWorkSpecial);
/**
* 新增生产专业管理
*
* @param dcBaseWorkSpecialDao 生产专业管理
* @param dcBaseWorkSpecial 生产专业管理
* @return 结果
*/
public int insertDcBaseWorkSpecialDao(DcBaseWorkSpecialDao dcBaseWorkSpecialDao);
public int insertDcBaseWorkSpecial(DcBaseWorkSpecial dcBaseWorkSpecial);
/**
* 修改生产专业管理
*
* @param dcBaseWorkSpecialDao 生产专业管理
* @param dcBaseWorkSpecial 生产专业管理
* @return 结果
*/
public int updateDcBaseWorkSpecialDao(DcBaseWorkSpecialDao dcBaseWorkSpecialDao);
public int updateDcBaseWorkSpecial(DcBaseWorkSpecial dcBaseWorkSpecial);
/**
* 删除生产专业管理
@ -53,7 +53,7 @@ public interface DcBaseWorkSpecialMapper extends BaseMapper<DcBaseWorkSpecialDao
* @param id 生产专业管理主键
* @return 结果
*/
public int deleteDcBaseWorkSpecialDaoById(Long id);
public int deleteDcBaseWorkSpecialById(Long id);
/**
* 批量删除生产专业管理
@ -61,5 +61,5 @@ public interface DcBaseWorkSpecialMapper extends BaseMapper<DcBaseWorkSpecialDao
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteDcBaseWorkSpecialDaoByIds(Long[] ids);
public int deleteDcBaseWorkSpecialByIds(Long[] ids);
}

38
lzbi-module/src/main/java/com/lzbi/special/service/DcBaseWorkSpecialService.java

@ -4,7 +4,7 @@ import java.util.List;
import com.lzbi.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.lzbi.special.domain.DcBaseWorkSpecialDao;
import com.lzbi.special.domain.DcBaseWorkSpecial;
import com.lzbi.special.mapper.DcBaseWorkSpecialMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -15,7 +15,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
* @date 2023-11-28
*/
@Service
public class DcBaseWorkSpecialService extends ServiceImpl<DcBaseWorkSpecialMapper, DcBaseWorkSpecialDao> implements IService<DcBaseWorkSpecialDao>
public class DcBaseWorkSpecialService extends ServiceImpl<DcBaseWorkSpecialMapper, DcBaseWorkSpecial> implements IService<DcBaseWorkSpecial>
{
@ -26,47 +26,47 @@ public class DcBaseWorkSpecialService extends ServiceImpl<DcBaseWorkSpecialMappe
* @return 生产专业管理
*/
public DcBaseWorkSpecialDao selectDcBaseWorkSpecialDaoById(Long id)
public DcBaseWorkSpecial selectDcBaseWorkSpecialById(Long id)
{
return baseMapper.selectDcBaseWorkSpecialDaoById(id);
return baseMapper.selectDcBaseWorkSpecialById(id);
}
/**
* 查询生产专业管理列表
*
* @param dcBaseWorkSpecialDao 生产专业管理
* @param dcBaseWorkSpecial 生产专业管理
* @return 生产专业管理
*/
public List<DcBaseWorkSpecialDao> selectDcBaseWorkSpecialDaoList(DcBaseWorkSpecialDao dcBaseWorkSpecialDao)
public List<DcBaseWorkSpecial> selectDcBaseWorkSpecialDaoList(DcBaseWorkSpecial dcBaseWorkSpecial)
{
return baseMapper.selectDcBaseWorkSpecialDaoList(dcBaseWorkSpecialDao);
return baseMapper.selectDcBaseWorkSpecialList(dcBaseWorkSpecial);
}
/**
* 新增生产专业管理
*
* @param dcBaseWorkSpecialDao 生产专业管理
* @param dcBaseWorkSpecial 生产专业管理
* @return 结果
*/
public int insertDcBaseWorkSpecialDao(DcBaseWorkSpecialDao dcBaseWorkSpecialDao)
public int insertDcBaseWorkSpecial(DcBaseWorkSpecial dcBaseWorkSpecial)
{
dcBaseWorkSpecialDao.setCreatedTime(DateUtils.getNowDate());
return baseMapper.insertDcBaseWorkSpecialDao(dcBaseWorkSpecialDao);
dcBaseWorkSpecial.setCreatedTime(DateUtils.getNowDate());
return baseMapper.insertDcBaseWorkSpecial(dcBaseWorkSpecial);
}
/**
* 修改生产专业管理
*
* @param dcBaseWorkSpecialDao 生产专业管理
* @param dcBaseWorkSpecial 生产专业管理
* @return 结果
*/
public int updateDcBaseWorkSpecialDao(DcBaseWorkSpecialDao dcBaseWorkSpecialDao)
public int updateDcBaseWorkSpecialDao(DcBaseWorkSpecial dcBaseWorkSpecial)
{
dcBaseWorkSpecialDao.setUpdatedTime(DateUtils.getNowDate());
return baseMapper.updateDcBaseWorkSpecialDao(dcBaseWorkSpecialDao);
dcBaseWorkSpecial.setUpdatedTime(DateUtils.getNowDate());
return baseMapper.updateDcBaseWorkSpecial(dcBaseWorkSpecial);
}
/**
@ -76,9 +76,9 @@ public class DcBaseWorkSpecialService extends ServiceImpl<DcBaseWorkSpecialMappe
* @return 结果
*/
public int deleteDcBaseWorkSpecialDaoByIds(Long[] ids)
public int deleteDcBaseWorkSpecialByIds(Long[] ids)
{
return baseMapper.deleteDcBaseWorkSpecialDaoByIds(ids);
return baseMapper.deleteDcBaseWorkSpecialByIds(ids);
}
/**
@ -88,8 +88,8 @@ public class DcBaseWorkSpecialService extends ServiceImpl<DcBaseWorkSpecialMappe
* @return 结果
*/
public int deleteDcBaseWorkSpecialDaoById(Long id)
public int deleteDcBaseWorkSpecialById(Long id)
{
return baseMapper.deleteDcBaseWorkSpecialDaoById(id);
return baseMapper.deleteDcBaseWorkSpecialById(id);
}
}

19
lzbi-module/src/main/resources/mapper/asset/DcBaseWorkSpecialMapper.xml

@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.lzbi.special.mapper.DcBaseWorkSpecialMapper">
<resultMap type="com.lzbi.special.domain.DcBaseWorkSpecialDao" id="DcBaseWorkSpecialResult">
<resultMap type="com.lzbi.special.domain.DcBaseWorkSpecial" id="DcBaseWorkSpecialResult">
<result property="tenantId" column="TENANT_ID" />
<result property="REVISION" column="REVISION" />
<result property="createdBy" column="CREATED_BY" />
@ -22,20 +22,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select TENANT_ID, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, DELETE_BY, DELETE_TIME, id, special_code, special_name from dc_base_work_special
</sql>
<select id="selectDcBaseWorkSpecialDaoList" parameterType="DcBaseWorkSpecialDao" resultMap="DcBaseWorkSpecialResult">
<select id="selectDcBaseWorkSpecialList" parameterType="DcBaseWorkSpecial" resultMap="DcBaseWorkSpecialResult">
<include refid="selectDcBaseWorkSpecialVo"/>
<where>
<if test="specialCode != null and specialCode != ''"> and special_code = #{specialCode}</if>
<if test="specialName != null and specialName != ''"> and special_name like concat('%', #{specialName}, '%')</if>
</where>
ORDER BY
CASE
WHEN updated_time IS NOT NULL AND updated_time > created_time THEN updated_time
ELSE created_time
END DESC
</select>
<select id="selectDcBaseWorkSpecialDaoById" parameterType="Long" resultMap="DcBaseWorkSpecialResult">
<select id="selectDcBaseWorkSpecialById" parameterType="Long" resultMap="DcBaseWorkSpecialResult">
<include refid="selectDcBaseWorkSpecialVo"/>
where id = #{id}
</select>
<insert id="insertDcBaseWorkSpecialDao" parameterType="DcBaseWorkSpecialDao" useGeneratedKeys="true" keyProperty="id">
<insert id="insertDcBaseWorkSpecial" parameterType="DcBaseWorkSpecial" useGeneratedKeys="true" keyProperty="id">
insert into dc_base_work_special
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tenantId != null">TENANT_ID,</if>
@ -63,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<update id="updateDcBaseWorkSpecialDao" parameterType="DcBaseWorkSpecialDao">
<update id="updateDcBaseWorkSpecial" parameterType="DcBaseWorkSpecial">
update dc_base_work_special
<trim prefix="SET" suffixOverrides=",">
<if test="tenantId != null">TENANT_ID = #{tenantId},</if>
@ -80,11 +85,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<delete id="deleteDcBaseWorkSpecialDaoById" parameterType="Long">
<delete id="deleteDcBaseWorkSpecialById" parameterType="Long">
delete from dc_base_work_special where id = #{id}
</delete>
<delete id="deleteDcBaseWorkSpecialDaoByIds" parameterType="String">
<delete id="deleteDcBaseWorkSpecialByIds" parameterType="String">
delete from dc_base_work_special where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}

Loading…
Cancel
Save